THE WORLD'S LARGEST WEB DEVELOPER SITE

Python String isspace() Method

❮ String Methods


Example

Check if all the characters in the text are whitespaces:

txt = "   "

x = txt.isspace()

print(x)
Run example »

Definition and Usage

The isspace() method returns True if all the characters in a string are whitespaces, otherwise False.


Syntax

string.isspace()

Parameter Values

No parameters.


More Examples

Example

Check if all the characters in the text are whitespaces:

txt = "   s   "

x = txt.isspace()

print(x)
Run example »

❮ String Methods