Check If a String is Empty
Simple Way
my_var = ""
if my_var == "":
print("Variable is empty!")
else:
print("Variable is not empty!")Advanced Way
my_var = ""
if my_var:
print("Variable is not empty!") # True when a non-empty string is found
else:
print("Variable is empty!") # True when an empty string is foundLast updated