Python - String Method - isspace() Tutorial
The isspace() method returns True if there is only whitespace in the string. otherwise, it returns False.
Syntax-
String.isspace()
Example-
str1 = " \t "
print(str1.isspace())
str2 = "\n "
print(str2.isspace())
str3 = " a "
print(str3.isspace())
Output-
True
True
False