You are here : python_2stringstringisdigit

string.isdigit() - string

             

The method isdigit() checks whether the string consists of digits only.


  • NA


Syntax

str.isdigit()


Example

#!/usr/bin/python

str = "123456";  # Only digit in this string
print str.isdigit()

str = "this is string example....wow!!!";
print str.isdigit()


Output / Return Value

When we run above program, it produces following result −


True False


Limitations


Alternatives / See Also


Reference