[Tutor] How to get a script to open a text file with Python?

Tom tavspamnofwd at googlemail.com
Wed Jun 11 16:37:11 CEST 2008


Or this can open most things:

import webbrowser
webbrowser.open_new('file///' + filename)

On 11/06/2008, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
>  "Terry Carroll" <carroll at tjc.com> wrote
>
>
> >
> > > If TextPad is your default txt editor just use
> > > os.system("foo.txt")
> > >
> >
> > or os.startfile("foo.txt"); sounds like the equivalent, but for some
> > reason, I prefer it.
> >


More information about the Tutor mailing list