I have a string like
\"xdtwkeltjwlkejt7wthwk89lk\"
how can I get the index of the first digit in the string?
instr = 'nkfnkjbvhbef0njhb h2konoon8ll'
numidx = next((i for i, s in enumerate(instr) if s.isdigit()), None)
print numidx
output:
12
numidx will be the index of the first occurrence of a digit in instr. If there are no digits in instr, numidx will be None.
I didn't see this solution here, and thought it should be.