上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 38 下一页
摘要: glob模块 是最简单的模块之一,内容非常少。用它可以查找符合特定规则的文件路径名。跟使用windows下的文件搜索差不多。查找文件只用到三个匹配符:"*","?", "[]"。"*"匹配0个或多个字符;"?"匹配单个字符;"[]"匹配指定范围内的字符,如:[0-9]匹配数字。glob.glob ... 阅读全文
posted @ 2013-09-18 17:19 前行者2011 阅读(179) 评论(0) 推荐(0) 编辑
摘要: __metaclass__=type #定义使用新式类class Bird: def __init__(self): self.hungry = True #父类中的属性hungry def eat(self): if self.hungry: print 'Ha...Ha' self.hungry... 阅读全文
posted @ 2013-09-18 14:13 前行者2011 阅读(100) 评论(0) 推荐(0) 编辑
摘要: import glob,os#glob.glob()函数输出文件的绝对路径dirname='E:\\*' #使用通配符def putdir(dirname): for i in glob.glob(dirname): if os.path.isdir(i): putdir(i+os.sep+'*')... 阅读全文
posted @ 2013-09-17 18:16 前行者2011 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 群里讨论的一个问题:执行netstat-ano,打印输入有8090端口的行方法一:>>>importcommands>>>a=commands.getoutput('netstat-ano')>>>foriina.split('\n'):...if'8090'ini:...printi...tcp0... 阅读全文
posted @ 2013-09-17 17:49 前行者2011 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 官方文档:http://docs.python.org/library/sys.html#module-syssys.argv 命令行参数List,第一个元素是程序本身路径 sys.modules.keys() 返回所有已经导入的模块列表 sys.exc_info() 获取当前正在处理的异常类,ex... 阅读全文
posted @ 2013-09-13 16:49 前行者2011 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Sys模块函数之多,我只能选取自己认为比较实用的一些函数列在此处。借马云找员工的说法,”找最合适的而不是最天才的”,这句话,我个人觉得在很多方面都能适应,学习也不在话下。Sys模块功能的确很多,但我们应该将重点放在那些功能才是最适合我们的,为此,我列的这些函数,就是我认为比较适合我以后开发的函数。(... 阅读全文
posted @ 2013-09-13 16:42 前行者2011 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 清理屏幕:clearScreen.py[root@server132 backup]# cat clearScreen.py#coding:utf8import sys,osplat = sys.platformif plat in ('linux','linux2'): Cmd = 'clear'... 阅读全文
posted @ 2013-09-13 11:23 前行者2011 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 今天在centos操作系统上安装mysql,新建用户datam、密码datam后,在服务器上使用该用户登录:[root@server127~]# mysql -u datam –p提示:ERROR 1045 (28000): Access denied for user datam@localhos... 阅读全文
posted @ 2013-09-12 15:52 前行者2011 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 可以使用 o = __import__('os') 将os模块复制给变量o,__import__接收一个字符串。所以要是‘os’群里一个问题:def notfound(): return web.notfound("Sorry, the page you were looking for was n... 阅读全文
posted @ 2013-09-12 11:01 前行者2011 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 今天在scientific linux上安装mysql时出现错误:[root@magnesium Downloads]# rpm -ivhMySQL-server-5.5.29-2.linux2.6.x86_64.rpmerror: Failed dependencies:mysql conflic... 阅读全文
posted @ 2013-09-11 11:23 前行者2011 阅读(129) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 38 下一页