Created
July 9, 2015 16:46
-
-
Save yoxisem544/fe17a2153ac13462fd91 to your computer and use it in GitHub Desktop.
This file contains 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
from subprocess import Popen, PIPE | |
import tempfile | |
with tempfile.TemporaryFile() as tempf: | |
proc = Popen(['echo', 'a', 'b'], stdout=tempf) | |
proc.wait() | |
tempf.seek(0) | |
print tempf.read() | |
proc = Popen(['ifconfig'], stdout=tempf) | |
proc.wait() | |
tempf.seek(0) | |
print tempf.read()、'' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment