摘要:
match和findall的区别以及有括号和无括号的区别strvar = "hello\n\nworld"find_re = re.compile("hello[.|\n]*([\S]*)");rs = find_re.match(strvar);print rs.groups()#输出('world',)rs = find_re.findall(strvar);for x in rs: print x;#输出worldmatch是查找到匹配的字符串,也就是括号内的字符串,match应该是从一个字符串里面过滤出我们括号内需要的字符串,所以 阅读全文
posted @ 2013-10-06 22:28
linyilong
阅读(233)
评论(0)
推荐(0)
浙公网安备 33010602011771号