mfcheer

Python执行sh或py文件

不获取返回结果:

import os

os.system("sh /path/xx.sh '%s'" %(params))

获取返回结果:

import commands

(status,output) = commands.getstatusoutput("/path/xx.sh '%s'" %(params))
status是返回状态
output是返回结果

<!--more-->

← 全部文章

留言