Empty strings

Basic types / Strings

# Empty string literal
some_empty_string = ""
# Built out of nothing
another_empty_string = str()

# An empty string is falsy
is_empty = not some_empty_string
# is_empty is True
is_another_empty = not another_empty_string
# is_another_empty is True

# Spaces are not empty
spaces = "   "
spaces_empty = not spaces
# spaces_empty is False

# strip() makes it blank
spaces_blank = not spaces.strip()
# spaces_blank is True

print(f"{is_empty = }")
print(f"{is_another_empty = }")
print(f"{spaces_empty = }")
print(f"{spaces_blank = }")