Frage

My professor told me to download Enthought Canopy, then he showed me some files he was editing online and wanted me to take a look at them. He did this using the terminal. I'm pretty sure he just went into the terminal, typed python, then something else, then a file automatically popped up in the web browser. I can't remember what command he used and have searched online and came up with nothing. Would anybody know how to do this? Thanks!

(and yes I have the file name)

War es hilfreich?

Lösung

I believe that the simplest way to do this is to invoke the webbrowser package from the standard library:

from webbrowser import open_new
open_new("http://www.google.com")
open_new("file://<YOUR FILE PATH HERE>")

HTH,

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top