Python string method isspace() checks whether the string consists of whitespace.
Following is the syntax for isspace() method −
str.isspace()
NA
This method returns true if there are only whitespace characters in the string and there is at least one character, false otherwise.
The following example shows the usage of isspace() method.
#!/usr/bin/python str = " "; print str.isspace() str = "This is string example....wow!!!"; print str.isspace()
When we run above program, it produces following result −
True False