Javatpoint Logo
Javatpoint Logo

Python String isspace() Method

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.

Signature

Parameters

No parameter is required.

Return

It returns either True or False.

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

Python String isspace() Method Example 1

Output:

True

Python String isspace() Method Example 2

Output:

False

Python String isspace() Method 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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA