Python String isspace() Method Syntax

Syntax: string.isspace()

Returns:

  1. True – If all characters in the string are whitespace characters.
  2. False – If the string contains 1 or more non-whitespace characters.

Python String isspace() Method

Python String isspace() method returns “True” if all characters in the string are whitespace characters, Otherwise, It returns “False”. This function is used to check if the argument contains all whitespace characters, such as:

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

Similar Reads

Python String isspace() Method Syntax

Syntax: string.isspace() Returns: True – If all characters in the string are whitespace characters. False – If the string contains 1 or more non-whitespace characters....

Python String isspace() Method Example

Python3 string = "\n\t\n" print(string.isspace())...