calling programs from python

David MacQuigg shuvit at 127.0.0.1
Mon Dec 1 23:13:45 EST 2003


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




More information about the Python-list mailing list