Latest web development tutorials

Python3 isnumeric () method

Python3 string Python3 string


description

Are isnumeric () method to detect a string consisting of only numbers. This method is only for unicode object.

Note: The definition of a string of Unicode, just before the string with 'u' prefix can be, you can view the specific examples in this section.

grammar

isnumeric () method syntax:

str.isnumeric()

parameter

  • no.

return value

If the string contains only numeric characters, it returns True, otherwise False

Examples

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

#!/usr/bin/python3


str = "w3big2016"  
print (str.isnumeric())

str = "23443434"
print (str.isnumeric())

Examples of the above output results are as follows:

False
True

Python3 string Python3 string