Python isnumeric

Python isnumeric function is used to check whether the characters are numeric characters or not. And if they are numeric values, this method returns True otherwise, returns False. The syntax of the isnumeric function is


isnumeric example

The following set of examples helps you understand it. Please refer to the String and its Methods articles to understand them in Python.

Str1 = '123456789';
print('First Output  = ', Str1.isnumeric())

Str2 = '     ';
print('Output of a method For Empty Space is = ', Str2.isnumeric())

# Performing On Unicode Values
# \u00BD is the Unicode Value of '1/2'
Str3 = '\u00BD'.isnumeric()
print('Second Output  = ', Str3)

# Performing on both Numeric Values and Alphabets
Str4 = '123a'.isnumeric()
print('Third Output  = ', Str4)

# Performing on Float values
Str5 = '1234.67'.isnumeric()
print('Fourth Output  = ', Str5)

# Performing on Negative Values  
Str6 = '-1234'.isnumeric()
print('Fifth Output  = ', Str6)

# Performing on Numeric Values and Special Characters  
Str7 = '1234!@'.isnumeric()
print('Sixth Output  = ', Str7)
isnumeric Example