美文网首页
subprocess.Popen

subprocess.Popen

作者: 喵_3067 | 来源:发表于2021-11-08 10:53 被阅读0次

subprocess.Popen当 shell=True, shell 默认为 /bin/sh,设置成为以/bin/bash/执行

cmd = "ls -la"

ret = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,

                              executable="/bin/bash")

output = ret.stdout.readlines()

print(output)

相关文章

网友评论

      本文标题:subprocess.Popen

      本文链接:https://www.haomeiwen.com/subject/jrjuzltx.html