摘要: 正则表达式中,group()用来提出分组截获的字符串,()用来分组 eg: 阅读全文
posted @ 2018-03-06 17:40 筱筱的春天 阅读(443) 评论(0) 推荐(0)
摘要: 为了在文本操作时忽略大小写,需要在使用re 模块的时候给这些操作提供re.IGNORECASE 标志参数。比如 >>> text = 'UPPER PYTHON, lower python, Mixed Python'>>> re.findall('python', text, flags=re.I 阅读全文
posted @ 2018-03-06 17:36 筱筱的春天 阅读(7972) 评论(0) 推荐(0)
摘要: re.sub的功能 re是regular expression的缩写,表示正则表达式;sub是substitude的缩写,表示替换 re.sub是正则表达式的函数,实现比普通字符串更强大的替换功能 sub(pattern,repl,string,count=0,flag=0) 1))pattern正 阅读全文
posted @ 2018-03-06 15:38 筱筱的春天 阅读(42334) 评论(4) 推荐(0)