Python String isspace() Method

Example

Check if all characters in the text are spaces:

txt = "   "
x = txt.isspace()
print(x)

Run Instance

Definition and Usage

If all characters in the string are spaces, the isspace() method will return True, otherwise it will return False.

Syntax

string.isspace()

Parameter value

No parameters.

More Examples

Example

Check if all characters in the text are spaces:

txt = "   s   "
x = txt.isspace()
print(x)

Run Instance