What is isnumeric() in Python?

The isnumeric method in Python is used to check if every character in a string is a number.

Syntax

`string.isnumeric()` 

Return value

It returns True if every character in the string is a number, otherwise it will return False.

Example

print("11".isnumeric()) # numbers
print("hello".isnumeric()) # letters
print("hello11".isnumeric()) # combination of alphanumeric characters
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources