if variable is empty python code example
Example 1: check if variable is empty python
if variable:
# code goes here...
Example 2: check if value is empty python
a_variable = {}
is_a_empty = bool(a_variable)
print(is_a_empty)
# >>> False
b_variable = [1, 2, 3]
is_b_empty = bool(b_variable)
print(is_b_empty)
# >>> True