网络编程
位置:首页>> 网络编程>> Python编程>> python实时获取外部程序输出结果的方法

python实时获取外部程序输出结果的方法

作者:IM彼此  发布时间:2023-04-27 02:29:04 

标签:python,输出,结果

如下所示:


s=subprocess.Popen("ping baidu.com -t",bufsize=0,stdout=subprocess.PIPE,universal_newlines=True)
while True:
 nextline=s.stdout.readline()
 print(nextline.strip())
 if nextline=="" and scan.poll()!=None:
   break

来源:https://blog.csdn.net/qq_26724919/article/details/82027451

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com