我想在python脚本中获得一些外壳命令的输出,比如ls或df。我发现commands.getoutput('ls')被弃用了,但是subprocess.call('ls')只会给我返回代码。
ls
df
commands.getoutput('ls')
subprocess.call('ls')
我希望有一些简单的解决方案。
https://stackoverflow.com/questions/6657690
相似问题