2012年10月4日

摘要: 搜类几个链接http://blog.csdn.net/yima1006/article/details/7028924http://blog.sina.com.cn/s/blog_4a27780601012wnj.htmlhttp://www.cnblogs.com/cacique/archive/2012/09/30/2709143.htmlhttp://blog.csdn.net/kevin6216/article/details/6913005http://djangobook.py3k.cn/2.0/chapter01/cd /data/rootdirdjango-admin.py s 阅读全文
posted @ 2012-10-04 19:47 @Jin 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 官方文档:http://docs.python.org/library/configparser.html主要用到两个类写配置:ConfigParse.RawConfigParse类读配置:ConfigParse.ConfigParse类一、ConfigParse.RawConfigParse>>> import ConfigParser>>> config=ConfigParser.RawConfigParser()查看写的类有那些方法>>> dir(config)['OPTCRE', 'OPTCRE_NV' 阅读全文
posted @ 2012-10-04 15:35 @Jin 阅读(1331) 评论(0) 推荐(0) 编辑
摘要: 一、glob模块官方文档:http://docs.python.org/library/glob.html#module-globglob有点像*nix下面的grep,但又没有那么强大。1、说明:glob是python自己带的一个文件操作相关模块,用它可以查找符合自己目的的文件,就类似于Windows下的文件搜索,支持通配符操作,*,?,[]这三个通配符,*代表0个或多个字符,?代表一个字符,[]匹配指定范围内的字符,如[0-9]匹配数字。只有两个方法glob和iglob2、globglob.glob(pathname)该方法返回所有匹配的文件路径列表,该方法需要一个参数用来指定匹配的路径字符 阅读全文
posted @ 2012-10-04 13:58 @Jin 阅读(2156) 评论(0) 推荐(0) 编辑
摘要: 官方文档:http://docs.python.org/library/zipfile.html#module-zipfile如果考虑到跨平台,要考虑用zip压缩文件一、压缩使用zipfile模块将文件储存在 ZIP 文件里向压缩档加入文件很简单, 将文件名, 文件在 ZIP 档中的名称传递给 write 方法即可.write 方法的第三个可选参数用于控制是否使用压缩.默认为 zipfile.ZIP_STORED , 意味着只是将数据储存在档案里而不进行任何压缩.如果安装了 zlib 模块, 那么就可以使用 zipfile.ZIP_DEFLATED 进行压缩.import zipfileimp 阅读全文
posted @ 2012-10-04 13:30 @Jin 阅读(1710) 评论(0) 推荐(0) 编辑
摘要: 官方文档:http://docs.python.org/library/tarfile.html#module-tarfile一、打包制作文件>>> statement="This is a big line that ........">>> with open('/root/largeFile.txt','w') as myfile:... for x in xrange(20000):... x+=1 ... myfile.write("%s\n" % statement )1、打 阅读全文
posted @ 2012-10-04 11:38 @Jin 阅读(1707) 评论(0) 推荐(0) 编辑
摘要: 原文连接:http://blog.csdn.net/kiki113/article/details/4033017官方文档:http://docs.python.org/library/time.html#module-timepython 的内嵌time模板翻译及说明 另外还有一个datetime... 阅读全文
posted @ 2012-10-04 00:04 @Jin 阅读(275) 评论(0) 推荐(0) 编辑

导航