Skip to content

Instantly share code, notes, and snippets.

@thomasballinger
Created August 24, 2015 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasballinger/89d625cdd7f651ff467c to your computer and use it in GitHub Desktop.
Save thomasballinger/89d625cdd7f651ff467c to your computer and use it in GitHub Desktop.
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