The isnumeric() method in Python String checks whether the string consists of only numeric characters. This method exists only on Unicode objects. It returns True when all the characters in the string are numeric else returns False. Numeric characters are inclusive of the digit characters as well as the characters that hold Unicode numeric value property.
Note − In order to define a string as Unicode, one shall simply prefix u in the assignment to the opening quotation mark. Here is the example.
Below is the syntax for isnumeric() method:
This method returns true when all characters are numeric in the string, false otherwise.
The example below shows the usage of isnumeric() method.
str = u"this2009";
str = u"23443434";
When we run above program, it produces following result:
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.