How would I go about making a file open. Not the way you might think.

Lamonte Harris pyth0nc0d3r at gmail.com
Thu Aug 23 16:55:54 EDT 2007


I've completed this request and I got the answer already.

On 8/23/07, Larry Bates <larry.bates at websafe.com> wrote:
>
> Hendrik van Rooyen wrote:
> > Lamonte Harris  wrote:
> >
> >> Basically you can open a file by double clicking, and by default it
> would open
> > w/ what every program you have it set >to.  Most text files would open
> in
> > notepad.  How can I make a txt open so that notepad opens w/ the content
> in it
> > by >using just python.
> >
> > I asked this question just yesterday - and Tim Golden answered:
> >
> > os.startfile()
> >
> > - Hendrik
> >
> Actually os.startfile('filename.txt') will open the file with whatever
> application is associated with .txt files on that machine.  That could be
> different from notepad if the user has chosen to override the defaults.
>
> os.system('notepad.exe c:\\junk.txt')
>
> will force notepad.exe to load and it will load the file specified.
>
> All depends on what you want to do.
>
> -Larry
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070823/0c00a441/attachment.html>


More information about the Python-list mailing list