Launch a webpage on a Firefox (win) tab using Python
You need to use the webbrowser
module
import webbrowser
webbrowser.open('http://www.google.com')
[edit]
If you want to open a url in a non-default browser try:
webbrowser.get('firefox').open_new_tab('http://www.google.com')
Use os.startfile()
passing only the url. This will cause the URL to be opened in a new tab/window in the user's default browser, which is much nicer to your user.
You might want to try:
import os
os.spawnl(os.P_NOWAIT, r'C:\Program Files\Mozilla Firefox\Firefox.exe',
r'FireFox', '-new-tab', 'http://www.google.com/')
If you want to start a program with parameters the subprocess module is a better fit:
import subprocess
subprocess.call([r'C:\Program Files\Mozilla Firefox\Firefox.exe',
'-new-tab', 'http://www.google.com/'])