Hi.
Does this do what you want?
Does this do what you want?
import re string = '1the 5one 5529care 30over' for i in range(len(string)): digit = re.search('[0-9]', string[i]) if digit: print(f'Found digit {string[i]} at position {i}')
Output:Found digit 1 at position 0
Found digit 5 at position 5
Found digit 5 at position 10
Found digit 5 at position 11
Found digit 2 at position 12
Found digit 9 at position 13
Found digit 3 at position 19
Found digit 0 at position 20
{edit to remove my debug line of code}
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein