利用python编写监控程序,监控一个文件目录
函数:判断是否是数字法一:vi 11.py#!/usr/bin/pythondef fun(): sth = raw_input("please input something: ") try: if type(int(sth)) ==type(1):
统计系统中剩余的内存[root@Client-1 day2]#vi neicheng.py#!/usr/bin/pythonwith open('/proc/meminfo') as fd: for line in fd: if line.startswith('MemTotal'): &nb
if 流程控制的使用[root@Client-1 day2]# cat if.py#!/usr/bin/pythonscore = int(raw_input("Please a num: "))if score >= 90: print 'A' print 'very good'elif score >=80: &nbs
[root@Client-1 day1]# vi 1.py#!/usr/bin/pythonprint "hello word...."保存退出[root@Client-1 day1]# python 1.pyhello word....-----------------------------------------------------字节代码python 源码文件经编译后生成的扩展名后缀为
字典练习[root@Client-1 day1]# vi 1.py#!/usr/bin/pythoninfo = {}name = raw_input("please input name: ")age = raw_input("please input age: ")gender = raw_input("please input (M/F): ")info['name'] = nameinfo
1.源码安装 ipython 1.2.1[root@Client-1]# tar -xf ipython 1.2.1.tar.gz[root@Client-1]cd ipython 1.2.1[root@Client-1 ipython-1.2.1]# python setup.py install2.通过pip安装 ipython 1.2.1确认是否有epel源[r
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号