In this section we will learn what String isspace() method is and how to use it in Python.
What is String isspace() Method in Python?
The Python string isspace() method is used to see if the entire characters of a string value are nothing but white spaces.
For example, newlines and tabs are considered as part of white-spaces.
Python String isspace() Method Syntax:
String isspace() Method Parameter
The method does not take an argument.
String isspace() Method Return Value
The return value of this method is of type boolean.
The value True means the entire characters of the target string are white-spaces. And the value False means there’s at least one non-white-space character in that string value.
Note: if the target string value is empty, the return value of this method will be False as well!
Example: using python string isspace() method
s1= "\n " result = s1.isspace() print(result)