ouput redirection..a newbie question

Olaf Ferger admin at ferger.de
Mon Dec 15 11:04:28 EST 2003


On Mon, 15 Dec 2003 09:21:53 -0500, Jp Calderone <exarkun at intarweb.us>
wrote:

>  Perhaps more usefully, though, the "commands" module allows you to get the
>output of a program as a string:
>
>    foo = commands.getoutput("ls -al")

or:

  lines = os.popen("ls -la", "r").readlines()


Regards,

  Olaf

-- 
^D




More information about the Python-list mailing list