0

I have written a Python program using Python 3.3. The output is saved as an HTML file. I want the HTML file to pop open automatically and show the results at the end of the program. Is there ay solution for this? I'll appreciated your help. Thanks

1 Answers1

1

This should work:

>>> import webbrowser
>>> webbrowser.get('/usr/bin/google-chrome %s').open('http://google.com')
True

**This will open the Chrome web browser with the Google's homepage.

Change the url path to the file path of the html page and use file://{ followed by the html page path }

>>> webbrowser.get('/usr/bin/google-chrome %s').open('file://the/path/to/the/html/page')

Updated:

Try:

>>> webbrowser.get('windows-default').open('{ url path for static html page }')

Reference: python's webbrowser launches IE instead of default on windows 7

Community
  • 1
  • 1
Viren Rajput
  • 5,426
  • 5
  • 30
  • 41