Python3 isspace() Method
Description
The isspace() method in Python detects whether the string consists only of whitespace characters.
Syntax
Syntax of the isspace() method:
str.isspace()
Parameters
- None.
Return Value
Returns True if the string contains only whitespace, otherwise returns False.
Example
The following example demonstrates the isspace() method:
Example
#!/usr/bin/python3
str = " "
print (str.isspace())
str = "Example example....wow!!!"
print (str.isspace())
The output of the above example is:
True False
Other Extensions
Python3 String