{"id":3637,"date":"2022-12-01T20:49:53","date_gmt":"2022-12-01T20:49:53","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3637"},"modified":"2022-12-01T20:49:54","modified_gmt":"2022-12-01T20:49:54","slug":"python-string-isspace","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/python-string-isspace\/","title":{"rendered":"Python String isspace() Method With Example"},"content":{"rendered":"<p style=\"text-align: center;\">Python String isspace<\/p>\n<p>Now, we are going to explore the isspace method. As the name of the method says, the isspace method is used to check if all the characters in the string are whitespaces. So, this method is going to return True, if and only if all the characters in the string are whitespaces, and it returns False otherwise. So, whenever we need to check if all the characters in the string are whitespaces, we can use the isspace method.<\/p>\n<p>Let\u2019s have a look at a simple program, which tries to demonstrate the isspace method.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3639 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-isspace-METHOD.jpg\" alt=\"\" width=\"642\" height=\"102\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-isspace-METHOD.jpg 642w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-isspace-METHOD-300x48.jpg 300w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/><\/p>\n<h2 style=\"text-align: center;\">Python String isspace() Method<\/h2>\n<p>As you can see in the above program, we have two strings, in which the first string is not having all the characters as whitespaces, and in the second string, all the characters are whitespaces. So, if we are calling the isspace method on both the strings, the first output that we have is False, and the second output that we have is True. So, you can try executing the above program and observe the output. You can also play with the values for different outputs.<\/p>\n<p>So, as and when required, we can make use of the isspace method, which returns True or False, on the basis of whether or not, all the characters in the string are whitespaces.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python String isspace Now, we are going to explore the isspace method. As the name of the method says, the isspace method is used to check if all the characters in the string are whitespaces. So, this method is going to return True, if and only if all the characters in the string are whitespaces, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26,27],"class_list":{"0":"post-3637","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python-tutorial","7":"tag-python","8":"tag-python-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3637","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=3637"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3637\/revisions"}],"predecessor-version":[{"id":4175,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3637\/revisions\/4175"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}