Python isdecimal() method
Description
The Python isdecimal() method checks whether a string contains only decimal characters. This method only exists on unicode objects.
**Note:** To define a decimal string, simply add the 'u' prefix before the string.
Syntax
isdecimal() method syntax:
str.isdecimal()
Parameters
- None
Return Value
Returns True if the string contains only decimal characters, otherwise returns False.
Example
The following example shows how to use the isdecimal() function:
#!/usr/bin/python
str = u"this2009";
print str.isdecimal();
str = u"23443434";
print str.isdecimal();
The output of the above example is:
False
True
Python Strings