Python String isdecimal() Method
Example
Check if all the characters in a string are decimals (0-9):
txt = "1234"
x = txt.isdecimal()
print(x)
Try it Yourself »
Definition and Usage
The isdecimal()
method returns True if all the
characters are decimals (0-9).
This method can also be used on unicode objects. See example below.
Syntax
string.isdecimal()
Parameter Values
No parameters.
More Examples
Example
Check if all the characters in the unicode are decimals:
a = "\u0030" #unicode for 0
b = "\u0047" #unicode for
G
print(a.isdecimal())
print(b.isdecimal())
Try it Yourself »
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.