Created
August 24, 2015 17:42
-
-
Save thomasballinger/89d625cdd7f651ff467c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def preview(content): | |
import webbrowser | |
import tempfile | |
import time | |
with tempfile.NamedTemporaryFile(suffix='.html') as f: | |
f.write(content) | |
f.flush() | |
print f.name | |
webbrowser.open_new_tab('file://'+f.name) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment