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

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.

    View all posts