摘要: 常用正则表达式符号 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 '.' 默认匹配除\n之外的任意一个字符,若指定flag DOTALL,则匹配任意字符,包括换行 '^' 匹配字符开头,若指定flags MULTILINE,这种也可以匹 阅读全文
posted @ 2017-02-20 16:26 alston-lee 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 很多程序都有记录日志的需求,并且日志中包含的信息即有正常的程序访问日志,还可能有错误、警告等信息输出,python的logging模块提供了标准的日志接口,你可以通过它存储各种格式的日志,logging的日志可以分为 debug(), info(), warning(), error() and c 阅读全文
posted @ 2017-02-20 16:25 alston-lee 阅读(112) 评论(0) 推荐(0) 编辑
摘要: import xml.etree.ElementTree as ET tree=ET.parse('demo.xml') root=tree.getroot() for child in root: print(child.tag,child.attrib) for i in child: print(i.tag,i.text) 阅读全文
posted @ 2017-02-20 15:23 alston-lee 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 一:内建模块 1. time和datetime(http://www.jb51.net/article/49326.htm)在Python中,通常有这几种方式来表示时间:1)时间戳 2)格式化的时间字符串 3)元组(struct_time)共九个元素。由于Python的time模块实现主要调用C库, 阅读全文
posted @ 2017-02-20 11:13 alston-lee 阅读(147) 评论(0) 推荐(0) 编辑