* test11.py

import time
print "1"
time.sleep(2)
print "1"
time.sleep(2)
print "1"
time.sleep(2)
print "1"

* test.py

import subprocess


p = subprocess.Popen("python test11.py", shell=True, stdout=subprocess.PIPE)
# None表示正在执行中
while p.poll() is None: 
  out = p.stdout.readline()
  if out != "":
    print out

相关文章:

  • 2022-01-19
  • 2021-11-04
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-11-05
  • 2021-05-29
  • 2021-11-11
  • 2021-07-17
  • 2021-12-18
  • 2022-12-23
相关资源
相似解决方案