2015年5月27日

摘要: re.match与re.search的区别:re.match只匹配字符串的开始,如果字符串开始不符合正则表达式,则匹配失败,函数返回None;而re.search匹配整个字符串,直到找到一个匹配。 阅读全文
posted @ 2015-05-27 16:28 帅胡 阅读(364) 评论(0) 推荐(0) 编辑
摘要: >>> import os>>> os.path.exists('d:/assist')True>>> os.path.exists('d:/assist/getTeacherList.py')True>>> os.path.isfile('d:/assist')False>>> os.path.i... 阅读全文
posted @ 2015-05-27 13:41 帅胡 阅读(60577) 评论(0) 推荐(4) 编辑
摘要: #!/usr/bin/pythonimport pcapimport dpktimport redef main():pc=pcap.pcap(name="eth1") # 抓取 eth1pc.setfilter('tcp port 80') # 过滤表达式 tcp port 80for p_tim... 阅读全文
posted @ 2015-05-27 13:38 帅胡 阅读(5795) 评论(0) 推荐(0) 编辑
摘要: chr()、unichr()和ord()chr()函数用一个范围在range(256)内的(就是0~255)整数作参数,返回一个对应的字符。unichr()跟它一样,只不过返回的是Unicode字符,这个从Python 2.0才加入的unichr()的参数范围依赖于你的Python是如何被编译的。如... 阅读全文
posted @ 2015-05-27 10:01 帅胡 阅读(1980) 评论(0) 推荐(0) 编辑
摘要: Table1.1.字符串格式化代码格式描述%%百分号标记%c字符及其ASCII码%s字符串%d有符号整数(十进制)%u无符号整数(十进制)%o无符号整数(八进制)%x无符号整数(十六进制)%X无符号整数(十六进制大写字符)%e浮点数字(科学计数法)%E浮点数字(科学计数法,用E代替e)%f浮点数字(... 阅读全文
posted @ 2015-05-27 09:07 帅胡 阅读(1444) 评论(0) 推荐(0) 编辑

导航