Python Regex Find + Index Code Example


Example: regex find a word index of all matches

import re sentence = input("Give me a sentence ") word = input("What word would you like to find ") for match in re.finditer(word, sentence):     print (match.start(), match.end())

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?