[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
本文标题:python中执行linux命令方法4
本文链接:https://www.haomeiwen.com/subject/pbchkttx.html
网友评论