Advertisement
python_notes

Example SubProcess Usage Script

Jul 31st, 2014
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. """This is an example subprocess usage
  2.  
  3. import subprocess
  4.  
  5. proc = subprocess.Popen(['tail', '-500', 'mylogfile.log'], stdout=subprocess.PIPE)
  6.  
  7. for line in proc.stdout.readlines():
  8.    print line.rstrip()
  9. """
  10. #!/usr/bin/env python
  11. import subprocess
  12. subprocess.call("ls -l", shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement