Python isspace() Method
Description
The Python isspace() method checks whether the string consists only of spaces.
Syntax
The syntax of the isspace() method is:
str.isspace()
Parameters
- None.
Return Value
Returns True if the string contains only spaces; otherwise, returns False.
Example
The following example demonstrates the use of 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
Other Extensions
Python String