Latest web development tutorials

Python3 isdigit () method

Python3 string Python3 string


description

Are Python isdigit () method to detect a string consisting of only numbers.

grammar

isdigit () method syntax:

str.isdigit()

parameter

  • no.

return value

If the string contains only numeric Returns True otherwise False.

Examples

The following example shows an example of isdigit () method:

#!/usr/bin/python3

str = "123456"; 
print (str.isdigit())

str = "w3big example....wow!!!"
print (str.isdigit())

Examples of the above output results are as follows:

True
False

Python3 string Python3 string