相关疑难解决方法(0)

在Python中运行BASH内置命令?

有没有办法从Python运行BASH内置命令?

我试过了:

subprocess.Popen(['bash','history'],shell=True, stdout=PIPE)

subprocess.Popen('history', shell=True, executable = "/bin/bash", stdout=subprocess.PIPE)

os.system('history')
Run Code Online (Sandbox Code Playgroud)

及其许多变化.我想跑historyfc -ln.

python bash command subprocess

18
推荐指数
2
解决办法
7321
查看次数

标签 统计

bash ×1

command ×1

python ×1

subprocess ×1