Use Python String isnumeric() Method to check if the string is number or not. This method returns True if all the characters are numeric (0-9), otherwise False.
string.isnumeric()
Python checks if the string is a number Example
Simple python example to Check if a given string is numeric or not.
str1 = "1234567890"
x = str1.isnumeric()
print(x)
Output:
This function is used to check if the argument contains all numeric characters such as integers (Number in Python), fractions, subscript, superscript, roman numerals, etc.(all written in Unicode)
Do comment if you have any doubts and suggestions on this Python condition check topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.