I have a string like
\"xdtwkeltjwlkejt7wthwk89lk\"
how can I get the index of the first digit in the string?
In Python 3.8+ you can use re.search to look for the first \d (for digit) character class like this:
\d
import re my_string = "xdtwkeltjwlkejt7wthwk89lk" if first_digit := re.search(r"\d", my_string): print(first_digit.start())