Python Isspace String Method

Published: 29 September 2015
on channel: Code master
3,854
45

Python 3.7 isspace tutorial can be found at https://www.mastercode.online/courses...

Be sure to like, share and comment to show your support for our tutorials.

=======================================
Channel - https://goo.gl/pnKLqE
Playlist For This Tutorial - https://goo.gl/EyZFti
Latest Video - https://goo.gl/atWRkF
Facebook -   / mastercodeonline  
Twitter - https://twitter.com/mastercodeonlin?l...
Website - http://mastercode.online
======================================
Python Isspace String Method
In this Python tutorial we take a look at the Python isspace string method. The isspace string method will check a string object to confirm if the string object only contains white space if so then Python will return True if the object contains any other character other than a space then Python will return False.

Python Isspace String Method Syntax
'String Object'.isspace()

'String Object' - This is our string object that will be evaluated by the isspace string method.
.isspace() - The isspace string method will evaluate our string object and return a True if the object only contains spaces or False if our object contains anything other than a space.
Examples Of The Python Isspace String Method
#Example 1
''.isspace()
False

#Example 2
' '.isspace()
True

#Example 3
' a'.isspace()
False
Examples Explained

Example 1:

''.isspace() - We create a empty string object and call isspace on our string method. Empty string contains no characters or spaces.

False - We are returned False because the string does not contain any spaces.
Example 2:

' '.isspace() - We create a string object that contains a space then we call the isspace string method on the string.

True - We are returned True since the string object contains a space.
Example 3:

' a'.isspace() - We create a string object that contains a space and the letter 'a'. Then we call our string isspace string method on our string object.

False - We are returned a False boolean since our string contains a letter. The isspace string method must only contain only spaces for a True boolean return.
Conclusion

In this Python tutorial, we took a look at the isspace string method in Python which returns True if the string object only contains spaces. If the string object contains anything other than a space then Python will return False. If you have any questions about isspace string method leave a comment below.


On this page of the site you can watch the video online Python Isspace String Method with a duration of hours minute second in good quality, which was uploaded by the user Code master 29 September 2015, share the link with friends and acquaintances, this video has already been watched 3,854 times on youtube and it was liked by 45 viewers. Enjoy your viewing!