python指定浏览器打开特定URL

import os

url = 'www.cnblogs.com'
command1 = '"C:\Program Files\Internet Explorer\iexplore.exe" %s' % url
command2 = '"C:\Program Files\Google\Chrome\Application\chrome.exe" %s' % url
command3 = '"D:\Program Files\Mozilla Firefox\\firefox.exe" %s' % url
os.system(command1)
os.system(command2)
os.system(command3)

老婆需要一个小插件,可以指定URL,并且用不同的浏览器打开,查了下原来很简单几行代码。于是记录下来。

URL是指定的网址,可以修改。

下面command1,2,3是指定的浏览器,这里是IE,chrome和firefox,需要在自己电脑上指定路径。

原文地址:https://www.cnblogs.com/alexkh/p/3009024.html