Check a String is Space in Python

  • Post category:String

In this article, you will see how to check a string is space in Python. A space string is a string that contains only spaces. The string isspace() method returns True if all characters in the string are spaces, otherwise False.

Step 1: Create a string

Python

Step 2: Check if a string is a space

Python

Output:

str =   
str type =  <class 'str'>
Space

Free resources to learn advanced skills: AiHints and CodeAllow