Python String isspace() Method
Advertisements
Description
The method isspace() checks whether the string consists of whitespace.
Syntax
Following is the syntax for isspace() method
str.isspace()
Parameters
NA
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
The following example shows the usage of isspace() method.
#!/usr/bin/python str = " "; print str.isspace(); str = "This is string example....wow!!!"; print str.isspace();
Let us compile and run the above program, this will produce the following result:
True False