import webbrowser, sys, os def openurl(self, url): try: webbrowser.open(url) except ImportError: # pre-webbrowser.py compatibility if sys.platform == 'win32': os.system('start "%s"' % url) elif sys.platform == 'mac': try: import ic except ImportError: pass else: ic.launchurl(url) else: rc = os.system('netscape -remote "openURL(%s)" &' % url) if rc: os.system('netscape "%s" &' % url)
來源參考: http://www.id-snippet.com/3202/open-browser-in-python/
沒有留言:
張貼留言