📜  如何在 python 代码示例中运行 shell 命令

📅  最后修改于: 2022-03-11 14:45:59.701000             🧑  作者: Mango

代码示例2
import subprocess

process = subprocess.Popen(['echo', 'hi'],
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)
out, err = process.communicate()
print(out) # hi
print(err) # None