Home

Published

- 1 min read

python open new chrome tab

img of python open new chrome tab

The solution for this is noted below

python open new chrome tab

Solution

   import webbrowser

url = 'http://docs.python.org/'

# MacOS
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'

# Windows
# chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'

# Linux
# chrome_path = '/usr/bin/google-chrome %s'

webbrowser.get(chrome_path).open(url)

Try other methods by searching on the site. That is if this doesn’t work