开发者

How can I open URLs in an existing browser window with the webbrowser module?

开发者 https://www.devze.com 2023-04-11 05:23 出处:网络
I’m using the webbrowser Python module to open images in Internet Explorer. Specifically, I’m using the webbrowser.open(\'C:...\', new=0) command.

I’m using the webbrowser Python module to open images in Internet Explorer. Specifically, I’m using the webbrowser.open('C:...', new=0) command.

However, even though I say new=0 my URL is always opened in a new browser window.

What can I do so my link is opened in an already-open browser window?

Thank开发者_如何学Python you for your help.


Try open_new_tab.

webbrowser.open_new_tab(url)

Open url in a new page (“tab”) of the default browser, if possible, otherwise equivalent to open_new().

From the docs: http://docs.python.org/library/webbrowser.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号