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

Python3 isspace() Method

Python3 isspace() Method

Python3 Strings Python3 Strings


Description

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

Syntax

Syntax of the isspace() method:


str.isspace()

Parameters

Return Value

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

Example

The following example demonstrates the isspace() method:

Example

#!/usr/bin/python3

str

=

"

"

print

(

str

.

isspace

(

)

)

str

=

"

Runoob example....wow!!!

"

print

(

str

.

isspace

(

)

)

The output of the above example is:


True
False

Python3 Strings Python3 Strings