码迷,mamicode.com
首页 > 编程语言 > 详细

python之函数

时间:2016-04-17 20:33:03      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/bin/env python
import subprocess
def uname_func():
        uname = "uname"
        uname_arg = "-a"
        print "Gathering system information with %s command:\n" % uname
        subprocess.call([uname,uname_arg])

def disk_func():
        diskspace = "df"
        diskspace_arg = "-h"
        print "Gathering diskspace infromation %s command:\n" % diskspace
        subprocess.call([diskspace,diskspace_arg])

def main():
        uname_func()
        disk_func()

main()

 

python之函数

标签:

原文地址:http://www.cnblogs.com/changbo/p/5401824.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!