os.system() 和os.popen()的区别

os.system() 和os.popen()的区别

返回的数据不同


1 os.system(“ls")  返回0

但是这样是无法获得到输出和返回值的

继续 Google,之后学会了 os.popen()。 view sourceprint?

a... output = os.popen('cat /proc/cpuinfo') 

b... print output.read()


你可能感兴趣的:(Google)