python中执行linux命令方法4 2016-01-14 本文已影响39人 如来自然 [root@bogon IP]# vim bash4.py !/usr/bin/env python import commands commands = commands.getoutput("date") print commands 测试: [root@bogon IP]# python bash4.py Mon Jan 11 09:24:56 PST 2016