0
点赞
收藏
分享

微信扫一扫

python os.system 命令阻塞


在python 中执行 os.system(“ping www.baidu.com”) 等命令的时候会阻塞,
它会等待 os.system 里的命令执行完才会返回。
有的时候我们需要并行运行:

在Linux平台上 只需要在命令末尾加上shell后台运算符&即可:

os.system('ping www.baidu.com &')

在Windows下,用DOS的start命令通常也能使命令并行启动:

os.system('start ping www.baidu.com ')


举报

相关推荐

0 条评论