简体   繁体   English

在Python中并排打开多个浏览器窗口?

[英]Open multiple browser windows side-by-side in Python?

From python, I'm hoping to launch three chrome browser windows side-by-side. 从python开始,我希望并排启动三个chrome浏览器窗口。 However, webbrowser seems to not have that advanced functionality. 但是,Web浏览器似乎没有该高级功能。

Is there a way to do this in Python? 有没有办法在Python中做到这一点?

EDIT: I'm specifically looking for solutions on a mac. 编辑:我正在Mac上专门寻找解决方案。

import webbrowser as wb

google = ('Google search:')
tabs = ['tab1', 'tab2', 'tab3'] #using this you can add more tabs
i = 0
while i < len(tabs):
    print (wb.open_new_tab('http://www.google.com/search?btnG=1&q=%s' % google))
    i = i + 1

this will use your default browser(in this case chrome) 这将使用您的默认浏览器(在本例中为chrome)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM