问题描述
尝试构建一个快速脚本,当我开始一天的内容注销趋势时,它会打开我需要的所有网页。
问题是,当我将 webbrowser
模块与 python 一起使用时,如果没有已打开的 google chrome 实例,我的脚本不会运行它的循环以在选项卡中打开新 url。
正如您将在下面的代码中看到的那样,我尝试先打开一个 chrome 实例,然后再尝试遍历新的 url,但它仍然不起作用。任何想法都会非常感激!
import webbrowser
# Url's that show me whats trending on the day #
trending_urls = ['news.google.com','bbc.com','trends.google.com/trends/trendingsearches/daily?geo=US','twitter.com/explore/tabs/trending']
chrome_path = webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s")
chrome_path.open('google.com',new=1,autoraise=True)
def openURLs(urlarr):
for url in urlarr:
chrome_path.open_new_tab(url)
openURLs(trending_urls)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)