Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. from subprocess import Popen, PIPE
  2. import tempfile
  3.  
  4. with tempfile.TemporaryFile() as tempf:
  5. proc = Popen(['echo', 'a', 'b'], stdout=tempf)
  6. proc.wait()
  7. tempf.seek(0)
  8. print tempf.read()
  9.  
  10. proc = Popen(['ifconfig'], stdout=tempf)
  11. proc.wait()
  12. tempf.seek(0)
  13. print tempf.read()、''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement