Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python isspace() method

Python isspace() method

Python Strings Python Strings


Description

The Python isspace() method checks whether a string consists only of whitespace.

Syntax

isspace() method syntax:


str.isspace()

Parameters

Return Value

Returns True if the string contains only spaces, otherwise False.

Example

The following example demonstrates the isspace() method:


#!/usr/bin/python

str = "       "; 
print str.isspace();

str = "This is string example....wow!!!";
print str.isspace();

The output of the above example is:


True
False

Python Strings Python Strings