Boolean String Methods



Following methods in str class return True or False.

Sr.No. Methods & Description

1

isalnum()

Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.

2

isalpha()

Returns true if string has at least 1 character and all characters are alphabetic and false otherwise.

3

isdigit()

Returns true if the string contains only digits and false otherwise.

4

islower()

Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.

5

isnumeric()

Returns true if a unicode string contains only numeric characters and false otherwise.

6

isspace()

Returns true if string contains only whitespace characters and false otherwise.

7

istitle()

Returns true if string is properly "titlecased" and false otherwise.

8

isupper()

Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.

9

isascii()

Returns True is all the characters in the string are from the ASCII character set

10

isdecimal()

Checks if all the characters are decimal characters

11

isidentifier()

Checks whether the string is a valid Python identifier

12

isprintable()

Checks whether all the characters in the string are printable

python_string_methods.htm
Advertisements