How do you check for numbers in Python and what do u need to import

Python password validation

3/31/2020 7:18:49 PM

David Afolabi

2 Answers

New Answer


s = "abcd1234" for c in s: if c.isdigit(): print(c) there are other ways too.


import the module re and use either r"\d" or r"[1-9]" to express numbers, for more information check the Regular expressions sololearn module in python.