Feed on

this is almost certainly not the best way to read the output of a python system call.  but, it works.    let’s say i’d like to read the results of a call to ls.  here’s how to do it:

import subprocess

proc = subprocess .Popen([ls],stdout=sub.PIPE)

print proc.stdout.read()

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS