python is space 1

python is space

# isspace() is method of the  returns True if the string has only empty spaces
print(" ".isspace())  # True
print("     ".isspace()) # True
print(" test".isspace())  # False
print("".isspace()) # False

Here is what the above code is Doing:
1. The first print statement is printing True because the string has only empty spaces.
2. The second print statement is printing True because the string has only empty spaces.
3. The third print statement is printing False because the string has a character other than empty spaces.
4. The fourth print statement is printing False because the string is empty.

Similar Posts