Thursday, March 8, 2018

String isspace() Method


String isspace() Method in Python 3


The isspace() method checks whether the string consists of whitespace..

Syntax
str.isspace()

Return Value
This method returns true if there are only whitespace characters in the string and there is at least one character, false otherwise.

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

Result
True
False