【发布时间】:2011-03-25 07:14:36
【问题描述】:
我需要在生成和运行子进程时显示一些进度条或其他内容。 我怎么能用python做到这一点?
import subprocess
cmd = ['python','wait.py']
p = subprocess.Popen(cmd, bufsize=1024,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.stdin.close()
outputmessage = p.stdout.read() #This will print the standard output from the spawned process
message = p.stderr.read()
我可以使用这段代码生成子进程,但我需要在每一秒过去时打印出一些东西。
【问题讨论】:
标签: python subprocess progressdialog