CKTIS / Python
str.isspace
Recognizes nonempty strings containing only Unicode whitespace.
Version: Python 3.14; repository image, production runtime not attested
Syntax
s.isspace()Recognizes nonempty strings containing only Unicode whitespace.
An empty string contains no whitespace; a Unicode em space by itself passes the test.
Ordinary spaces and tabs qualify, as does the em space U+2003 in the example. The empty string fails because this test requires at least one character.
assert "\t\n".isspace() and not "\u200b".isspace()
Examples
print(" ".isspace())
print("".isspace())
Result
True False
Ordinary spaces and tabs qualify, as does the em space U+2003 in the example. The empty string fails because this test requires at least one character.