0

can i have example for re.finditer ?

14th Jun 2017, 10:29 AM
Nithya Mk
Nithya Mk - avatar
2 ответов
0
import re pattern = re.compile(r'in',re.M) example = "an example matching any 'in' herein!" for item in re.finditer(pattern,example): print('match object data:',item,' the text matched:',item.group())
14th Jun 2017, 11:45 AM
richard
0
import re text="i love python so much. The most beloved people in the world are the spontaneous" for m in re.finditer(r"\w+ve", text): print m.group(0) output: love belove
9th Jan 2018, 6:46 AM
Rajendra Prasad Naik
Rajendra Prasad Naik - avatar