Created
November 29, 2012 01:21
-
-
Save terryjbates/4166098 to your computer and use it in GitHub Desktop.
Python code snippet with processing of stdout output gotten from Popen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess | |
p = subprocess.Popen(["/bin/ls", "-l"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) | |
for line in p.stdout: | |
print line.strip() | |
for output in file.stdout.readlines(): | |
if "FontCache" in output: | |
outputfile.write(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment