KennisbankExamencentrum
NL · NLNederlands (Nederland)
Taal kiezen13

CKTIS / Python

str.isspace

Geeft alleen True voor niet-lege tekst met uitsluitend witruimte.

Versie: Python 3.14; repository image, production runtime not attested

Syntax

s.isspace()

Geeft alleen True voor niet-lege tekst met uitsluitend witruimte.

U+2003 is een em-spatie en voldoet net als een gewone spatie of tab.

De lege tekenreeks geeft False omdat minstens één teken nodig is.

assert "\t\n".isspace() and not "\u200b".isspace()

Voorbeelden

print(" ".isspace())
print("".isspace())

Resultaat

True
False

De lege tekenreeks geeft False omdat minstens één teken nodig is.

Bronnen