subprocess.Popen

2021-11-08  本文已影响0人  喵_3067

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)

上一篇 下一篇

猜你喜欢

热点阅读