As you see in the question, I am trying to create an URL shortcut in Python for both Windows and Linux.
Windows shortcut is working, this is my code if somebody needs it :
import os
target = "www.google.com"
with open(os.path.join(shortcut_path, "windows_shortcut.url"), "w") as f:
f.write('[InternetShortcut]\n')
f.write('URL=%s' % target)
But for Linux it is an other problem and I can't find any solution which is working for me with google.
This is what I tried :
import os
target = "www.google.com"
with open(os.path.join(shortcut_path, "linux_shortcut.url"), "w") as f:
f.write("""[Desktop Entry]
Encoding=UTF-8
Name=Link to google
Type=Link
URL=%s
Icon=text-html
Name[en_US]=commit""" % target)
Thanks for your time
顺便说一句,解决问题的方法很简单,只需将linux_shortcut.url
替换为linux_shortcut.desktop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.