Whitespace Check in Python

Level 122 keystrokes

This checks if all characters in the string are whitespace using the isspace() method.

Python code

# isspace() returns True if the string is not empty and every character is whitespace (space, tab, newline...)
# " " holds only three spaces, so True is printed
1print(" ".isspace())

Output

True
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • "× 2
  • (× 2
  • )× 2
  • .× 1

More Python examples at level 1

← Python typing practice