isspace() Function in Python – Check for space

isspace() Function in python checks whether the string consists of only space. lets see an example of python isspace() Function

 

Syntax for isspace() Function in Python:

str.isspace()

Returns true if only space is found else returns false.

 

Example of isspace() Function in python:

str1 = " "; 
print str1.isspace()

str1 = "    "; 
print str1.isspace()

str1 = "This is Beauty of Democracy";
print str1.isspace()

so the output will be

True
True
False

 

previous isspace() Function in Python                                                                                                          next isspace() Function in Python

Do NOT follow this link or you will be banned from the site!