python コマンドの実行

import commands
print(commands.getstatusoutput("ls"))
#(0, 'IMG\nhaihuri_op.mp4\nsample.py')

print(commands.getoutput("ls"))
#IMG
#haihuri_op.mp4
#sample.py

36.16. commands — コマンド実行ユーティリティ — Python 2.7.13 ドキュメント