The isdecimal() method in Python checks if the string consists of only specific decimal characters. This method in Python string is thus present only on specific unicode objects. The isdecimal()- method in Python is a function that returns true in case all the characters within a string are decimal. If each character in the string is not decimal then it would return false.
Note − In order to define a string as Unicode, one shall simply prefixe a 'u' to the assignment of the opening quotation mark. Below is the example.
Here is the syntax for isdecimal() method:
This method in Python string is supposed to return true if in case all characters in the string are decimal, else it would return false.
The following example below shows the usage of isdecimal() method.
str = u"this2009";
str = u"23443434";
When the above above program is run, it produces the following result:
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.