Latest web development tutorials

Python isspace () method

Python strings Python strings


description

Are Python isspace () method to detect the string consists of only spaces.

grammar

isspace () method syntax:

str.isspace()

parameter

  • no.

return value

If the string contains only spaces, returns True, otherwise False.

Examples

The following example shows an example of isspace () method:

#!/usr/bin/python

str = "       "; 
print str.isspace();

str = "This is string example....wow!!!";
print str.isspace();

Examples of the above output results are as follows:

True
False

Python strings Python strings