Home / Python / Reference / String methods

Python string isspace() method

Check whether every character is whitespace (spaces, tabs, new lines).

Syntax

str.isspace()

Parameters

None.

Return value

bool

Example

Code

print("   ".isspace(), " \t\n".isspace(), "".isspace(), " a ".isspace())

Output

True True False False

Related

Learn it step by step in the free lesson Strings, with exercises that check your answers.