比如html页面有多个div 里面有不同的标签容器
伪代码如下
while True:
re.search("<div",html);
....
re.match("aa")
or re.match("bb")
..
伪代码如下
while True:
re.search("<div",html);
....
re.match("aa")
or re.match("bb")
..
1
phuslu May 2, 2013 via iPhone
re.finditer 可能是你要的.
|
2
yakczh OP 没有do whilte ,只能用white True了
while True: m=p.search(text,index) if m==None: break print "\n matched" match= m.group() .... index= m.end() |