Python isspace() method
Description
The Python isspace() method checks whether a string consists only of whitespace.
Syntax
isspace() method syntax:
str.isspace()
Parameters
- none.
Return Value
Returns True if the string contains only spaces, otherwise False.
Example
The following example demonstrates the isspace() method:
#!/usr/bin/python
str = " ";
print str.isspace();
str = "This is string example....wow!!!";
print str.isspace();
The output of the above example is:
True
False
Python Strings