使用Python開啟瀏覽器上網

import webbrowser 
firefoxPath = r'C:\Program Files\Mozilla Firefox\firefox.exe'
webbrowser.register('firefox', None, webbrowser.BackgroundBrowser(firefoxPath))
with open("urls.txt") as f:
for url in f:
webbrowser.get('firefox').open(url,new=1,autoraise=True)

會寫這份程式的原因在於:電腦中的火狐瀏覽器並非預設瀏覽器,加上電腦與人共用,不想做更動。

參考資料:

Written by

Machine Learning / Deep Learning / Python / Flutter cakeresume.com/yanwei-liu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store