The isspace Method in Python: Checking a String for Whitespace Characters
Returns True or False, indicating whether a string contains only whitespace characters.
isspace()
Returns True if the string contains characters and all of them are whitespace; otherwise, returns False.
' '.isspace() # True
'\n'.isspace() # True
'\t'.isspace() # True
' '.isspace() # True (OGHAM SPACE MARK)
''.isspace() # False
'!@#'.isspace() # False
'abc'.isspace() # False
'123'.isspace() # False
'abc123'.isspace() # False
Whitespace characters are Unicode characters from the Other or Separator category, as well as those with a bidirectional property value of WS, B, or S.