[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/lqlstudio/netkiller.github.io/master/python/../python/popen.html [Back]  [Original]

7.3.PopenHome | | | | Search | ITEYE | OSChina | Facebook | Linkedin | | Email

7.3.Popen

#!/usr/bin/python

from  subprocess import *
p = Popen(["cat", "-n"], bufsize=1024,stdin=PIPE,
                    stdout=PIPE, close_fds=True)

(fin, fout) =  (p.stdin, p.stdout)
for i in range(10):
   fin.write("line" + str(i))
   fin.write('\n')
   fin.flush()
   print fout.readline(),
		
comments powered by Disqus

Web Proxy Viewer  |  New URL  |  Original Page