Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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()、''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement