On 20 Nov 2005 12:00:02 -0800, "amfr" <[EMAIL PROTECTED]> wrote:
>Hoe would I call something on the command line from python, e.g. "ls >-la"? > Depends on how much control you want over where the output goes. If you want the result as a multi-line string formatted the way the system utility (ls here) formats it, and that you can process further (or print etc.) in your python script or interactive session, you may want >>> import os >>> result = os.popen('ls -la').read() >>> print result Usage: LS [/FrqRdlt1sSvu] [files] Oops, the ls I have on NT doesn't support "a" ;-) But you get the idea. You might have found this via the second link in Fredrik's post ( http://docs.python.org/lib/os-newstreams.html#os-newstreams ) but I thought you might miss it ;-) If you don't want the original system utility formatting, the python functions Fredrik showed make more sense, and are easier to use. ( posting delayed >12 hrs due to news server prob ;-/ ) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list