Python String isspace() Method

Last Updated : 30 Dec 2025

Python isspace() method is used to check space in the string. It returna true if there are only whitespace characters in the string. Otherwise it returns false. Space, newline, and tabs etc are known as whitespace characters and are defined in the Unicode character database as Other or Separator.

Syntax of Python String isspace() Method

It has the following syntax:

Parameters

No parameter is required.

Return

It returns either True or False.

Different Examples for Python String isspace() Method

Let's see some examples of isspace() method to understand it's functionalities.

Example 1

Let us take an example to demonstrate the working of Python String isspace() Method.

Output:

True

Example 2

Let us take an example to demonstrate the working of Python String isspace() Method.

Output:

False

Example 3

isspace() method returns true for all whitespaces like:

  • ' ' - Space
  • '\t' - Horizontal tab
  • '\n' - Newline
  • '\v' - Vertical tab
  • '\f' - Feed
  • '\r' - Carriage return

Output:

It contains space
Not space
It contains space
 
Next TopicPython Strings