import sys
with open("result.txt", "a") as f:
print("debug")
f.write(sys.argv[1])
条形图
import subprocess
for i in range(10):
CMD = "python foo.py %s" % i
p = subprocess.Popen(CMD, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE))
print(p.stdout.read().decode('utf-8'))
在这种情况下,您应该设置参数
shell=True
。举个例子:假设要从
bar
运行foo
10次:foo.py
条形图
运行
python bar.py
之后,我们得到了以下文件:结果.txt
标准输出
相关问题 更多 >
编程相关推荐