python 使用 os.system() 时没有返回正常的结果,返回了256 ubuntu16.04系统下 python版本 2.7.11

2025-05-22 14:39:52
推荐回答(2个)
回答(1):

os.system方法返回的是系统程序执行后的返回值。这里256也许是有256项。
要获得标准输出stdout需要用子进程模块subprocess,这是python3.x的做法。
2.7也许有类似吧.

回答(2):

具体什么错误呢,麻烦描述清楚。