Python String isspace() Method

❮ String Methods


Example

Check if all the characters in the text are whitespaces:

txt = "   "

x = txt.isspace()

print(x)
Try it Yourself »

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)
Try it Yourself »

❮ String Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.