Skip to content

Latest commit

 

History

History
54 lines (46 loc) · 920 Bytes

File metadata and controls

54 lines (46 loc) · 920 Bytes

isdigit

Description

Returns a Boolean stating whether the string contains only digits.

Syntax

str. isdigit()

Return Value

bool

Time Complexity

#TODO

Remarks

For 8-bit strings, this method is locale-dependent. Returns False if string is empty.

Example

>>> ''.isdigit()
False
>>> 'abc123'.isdigit()
False
>>> 'abc'.isdigit()
False
>>> '123'.isdigit()
True
>>> 'Abc'.isdigit()
False
>>> '!@#'.isdigit()
False
>>> '   '.isdigit()
False
>>> 'ABC'.isdigit()
False

See Also

isalnum(), isalpha(), isdigit(), islower(), isspace(), istitle(), isupper()