Location instances for all matching elements using python list
- 2021-06-28 12:55:09
- OfStack
As follows:
import re
word = "test"
s = "test abcdas test 1234 testcase testsuite"
w = [m.start() for m in re.finditer(word, s)]
print(w)
As follows:
import re
word = "test"
s = "test abcdas test 1234 testcase testsuite"
w = [m.start() for m in re.finditer(word, s)]
print(w)