摘要: 1 ''' 2 检查Python程序的一些基本规范,例如,运算符两测是否有空格,是否每次只导入一个模块,在不同的功能模块之间是否有空行,注释是否够多,等等 3 ''' 4 import sys 5 import re 6 7 def checkFormats(lines,desFileName): 8 fp=open(desFileName,'w') 9 ... 阅读全文
posted @ 2017-06-09 19:24 JustLittle 阅读(792) 评论(0) 推荐(0)
摘要: 1 import re 2 telNumber = '''Suppose my Phone No. is 0535-1234567,yours is 010-12345678,his is 025-87654321.''' 3 pattern = re.compile(r'(\d{3,4})-(\d{7,8})') 4 index = 0 5 while True: 6 ma... 阅读全文
posted @ 2017-06-09 15:37 JustLittle 阅读(3474) 评论(0) 推荐(0)
摘要: 1 ''' 2 正则表达式对象的sub(repl,string[,count=0])和subn(repl,string[,count=0])方法用来实现字符串替换功能 3 ''' 4 example='''Beautiful is better than ugly. 5 Explicit is better than implicit. 6 Simple is bette... 阅读全文
posted @ 2017-06-09 15:13 JustLittle 阅读(401) 评论(0) 推荐(0)
摘要: re模块使用 阅读全文
posted @ 2017-06-09 08:56 JustLittle 阅读(2740) 评论(0) 推荐(0)