In python, I have the following string:
"fish 14~ reel 14 rod B14"
I want to use REGEX to run through a for loop and return the location of each substring having one or more numbers in it. Ex.:
For ():
print location of substring
My expect output would be:
5
14
21
Please help, thanks.
ANSWER: Ok I tested all of the following and they all work. So which one is fastest? Drum roll.... In order from fastest to slowest: 1) Perreal - 9.7ms 2) Jon - 10.5ms 3) m.buettner - 12.3ms 4) upasana - 25.6ms
Thanks to all of you Python geniuses. There was another solution but I didn't test it. For various other reasons I chose Jon's method for my program.