I am trying to check if a string contains a number in Python. I have tried using the
isdigit() method, but it doesn’t seem to work in all cases. Can anyone suggest a reliable way to do this?
Here’s the code I have so far:
However, this code doesn’t work if the string contains other characters besides numbers. Is there a better way to check if a string contains a number, regardless of the other characters in the string?
Any help or suggestions would be greatly appreciated. Thank you!