Vérifiez si la chaîne est vide Python
my_str = ""
if not my_str:
print("empty")
else:
print("not empty")
#output: empty
Doubtful Dingo
my_str = ""
if not my_str:
print("empty")
else:
print("not empty")
#output: empty
if variable:
# code goes here...