Reading about Python? Actually practice it. Try PyChallenge free

Python Tutorial

String isdigit

Return True if string consits only of digits.

Syntax

The format is:
str.isdigit()

Parameters

None

Example

str = u"string digit 1234"
print( str.isdigit() )

str = u"12345" print( str.isdigit() )

Result:

False
True
BackNext

Practice
Stop reading. Start writing Python.
PyChallenge gives you interactive exercises in your browser — no install needed.
Practice Python with interactive exercises