Python3 isspace() Method

Python3 字符串Python3 String


Description

The isspace() method in Python detects whether the string consists only of whitespace characters.

Syntax

Syntax of the isspace() method:

str.isspace()

Parameters

  • None.

Return Value

Returns True if the string contains only whitespace, otherwise returns False.

Example

The following example demonstrates the isspace() method:

Example

#!/usr/bin/python3 str = " " print (str.isspace()) str = "Example example....wow!!!" print (str.isspace())

The output of the above example is:

True
False

Python3 字符串Python3 String

Other Extensions