[Tutor] How to get a script to open a text file with Python?
Alan Gauld
alan.gauld at btinternet.com
Wed Jun 11 05:26:24 CEST 2008
"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.
Actually os.startfile was what I meant for the default case!
Thanks for pointing it out. system() may work if the preference is
already set but startfile is specifically intended for that scnario.
Alan G
More information about the Tutor
mailing list