Latest web development tutorials

Python3 isspace () method

Python3 string Python3 string


description

Are Python isspace () method to detect the string consists of only spaces.

grammar

isspace () method syntax:

str.isspace()

parameter

  • no.

return value

If the string contains only spaces, returns True, otherwise False.

Examples

The following example shows an example of isspace () method:

#!/usr/bin/python3

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

str = "w3big example....wow!!!"
print (str.isspace())

Examples of the above output results are as follows:

True
False

Python3 string Python3 string