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)协同标准输入输出流使程序通信

posted @ 2022-12-16 14:49  YTT77  阅读(72)  评论(0编辑  收藏  举报