Python String isspace() method

The string.isspace() method returns a Boolean value true if there are only whitespace characters in the given string. This function is used to check if the given string contains any whitespace characters. The common example of whitespace characters are as follows:

  • ‘ ‘ – Space
  • ‘\t’ – Horizontal tab
  • ‘\n’ – Newline
  • ‘\v’ – Vertical tab
  • ‘\f’ – Feed
  • ‘\r’ – Carriage return

Syntax

Parameter

NA

Return

This method returns a boolean value “True” if all characters in the string are whitespace characters, else it returns “False” if the string contains 1 or more non-whitespace characters.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This