World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Designed by IITians, only for AI Learners.
New to InsideAIML? Create an account
Employer? Create an account
Find the adverbs from string using regular expression (re) module
Find all the adverbs and their positions using the re module
import re text = "She made me laugh wildly and uproariously." for v in re.finditer(r"\w+ly",text): print('%d-%d: %s' %(v.start(), v.end(),v.group(0)))
Output
18-24: wildly 29-41: uproariously