subprocess module

John Mechaniks at
Mon Jul 14 12:05:56 CEST 2008

On Jul 14, 12:34 pm, Peter Otten <__pete... at> wrote:
> John Mechaniks wrote:
> > from subprocess import call
> > call(['ls', '-l'])
> > How do I get the result (not the exit status of the command) of "ls -
> > l" into a variable?
> output = subprocess.Popen(["ls", "-l"], stdout=subprocess.PIPE)
> Peter

Thanks Peter.

Just curious

What difference does the following code makes? What are the advantages
of the above method over this one?
output = subprocess.Popen(['ls', '-l'],

Also could someone show an example of using the optional input
argument for communicate()

More information about the Python-list mailing list