发布时间:2014-02-19 00:04:07
这个很简单,只需要>>> import pysysinfoGathering system information with uname command:Linux oracle11g 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/LinuxGathering diskspace information df command:文件系统 容量 已用 可用 .........【阅读全文】
发布时间:2014-02-18 23:56:24
[root@oracle11g home]# cat pysysinfo_func.py #!/usr/bin/env python#A System Information Gathering Scriptimport subprocess#Command 1def uname_func():uname = "uname"uname_arg = "-a"print "Gathering system information with %s command:\n" %unamesubprocess.call([uname,uname_arg])#Com.........【阅读全文】
发布时间:2014-02-18 23:43:49
[root@oracle11g home]# cat pysysinfo.py #!/usr/bin/env python#A System Information Gathering Scriptimport subprocess#Command 1uname = "uname"uname_arg = "-a"print "Gathering system information with %s command:\n" %unamesubprocess.call([uname,uname_arg])#Command 2diskspace = "df".........【阅读全文】
发布时间:2014-02-18 23:35:20
用Python语言封装了一个linux命令,代码如下:[root@oracle11g home]# cat pyls.py #!/usr/bin/env python#Python wrapper for the ls commandimport subprocesssubprocess.call(["ls","-l"])[root@oracle11g home]# ./pyls.py 总用量 12drwx------. 5 oracle oinstall 4096 2月 12 18:11 oracle.........【阅读全文】
发布时间:2014-02-12 16:59:51
1.从用户那里得到输入最容易的方法就是使用raw_input函数,[root@oracle11g ~]# pythonPython 2.6.6 (r266:84292, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> user = raw_input('Enter login nam.........【阅读全文】