Linux管道符|
demo1.py中
print("Hello World!")
print(50)
demo2.py中
import sys
s = sys.stdin.readline()
print('This is my got string:%s'%s)
data = sys.stdin.readline()
print('This data is ' + data + 'Double is ' + str(int(data) * 2))
输出结果:
This is my got string:Hello World!
This data is 50
Double is 100
参考资料:
Python使用管道(pipe)协同标准输入输出流使程序通信