python的subprocess无法进行通信(无法通过管道输入数据)的问题解决

1.在主进程使用

p.stdin.write("something
")

要有回车!要有回车!要有回车!

2.在子进程使用

data = raw_input()

读取数据,再用

import sys
print 'something'
sys.stdout.flush()

输出数据,记得要flush!

2016.7.25 附:又被坑了一次。。。

原文地址:https://www.cnblogs.com/turtlegood/p/5452494.html