Python isdecimal () method
description
Python isdecimal () method checks whether the string contains only decimal characters. This method exists only in unicode object.
Note: The definition of a decimal string, just before the string with 'u' prefix can be.
grammar
isdecimal () method syntax:
str.isdecimal()
parameter
- no
return value
If the string contains only decimal character returns True, otherwise False.
Examples
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();
Examples of the above output results are as follows:
False True