calling programs from python

Richard James rmb25612 at yahoo.com
Tue Dec 2 18:19:30 EST 2003


David MacQuigg <shuvit at 127.0.0.1> wrote in message news:<k04osvscncmln06m83nam6jghrpjg79jd7 at 4ax.com>...
> On Mon, 01 Dec 2003 19:27:34 -0500, "RR" <ergodicsum at yahoo.com> wrote:
> 
> >Hello,
> >
> >I am trying to call a program in python as I would call it in the command
> >line. For example I want to do the following from python: command > file.
> >Then read this file. How do I call "command > file" ? Much help
> >appreciated.
> 
> Use os.system()  For example, on Unix:
> >>> import os
> >>> os.system( 'command > file' )
>  and on Windows:
> >>> os.system('start C:\Python23\python.exe')
> 
> -- Dave

Windows Python os module has os.startfile()

os.startfile('C:\Python23\python.exe')

-- Richard




More information about the Python-list mailing list