一:循环 忙等 子进程结束 import subprocess import os import time tt = ‘555‘ cmd = "python /home/100003/python/mypython/sub2.py "+" 333"+" 444 "+tt print time.time() sub2 = subprocess.Popen(cmd, shell=True) while 1: ret1 = subprocess.Popen.poll(sub2) if ret1 == 0: print sub2.pid,‘end‘ break elif ret1 is None: print ‘running‘ time.sleep(1) else: print sub2.pid,‘term‘ break print time.time()
时间: 2024-10-12 04:40:42