Created
April 18, 2014 07:34
-
-
Save fdanelyan/11029571 to your computer and use it in GitHub Desktop.
Generate HTML from python and open it on default browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# write-html.py | |
import webbrowser | |
import os | |
print () | |
f = open('helloworld.html','w') | |
message = """<html> | |
<head></head> | |
<body><p>Hello World!</p></body> | |
</html>""" | |
f.write(message) | |
f.close() | |
#Change path to reflect file location | |
filename = 'file:///'+os.getcwd()+'/' + 'helloworld.html' | |
webbrowser.open_new_tab(filename) |
Thanks for this code.
Thanks man, this one did me a real favor in my pet project.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks