Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # str_find_all_indexes.py
- import re
- aString = 'this is a string where the substring "is" is repeated several times'
- print [(a.start(), a.end()) for a in list(re.finditer('is', aString))]
- [(2, 4), (5, 7), (38, 40), (42, 44)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement