「python入門」シェルスクリプトを実行するサンプル

1.os.system
os.system('cat /proc/cpuinfo’)

2.os.popen()
output = os.popen('cat /proc/cpuinfo’)
print output.read()

3. commands.getstatusoutput()
(status, output) = commands.getstatusoutput('cat /proc/cpuinfo’)
print status, output

Python

Posted by arkgame