How to check if a variable is empty in Python

Checking if a variable is empty returns True if the variable has a non-empty value, and False otherwise. Empty values include empty sequences, the integer 0, and the None value.

Solution for How to check if a variable is empty in Python : You can use bool() to check if a variable is empty Call bool(o) with o set as a variable to check if the variable contains an empty value.

a_variable = [1, 2, 3]


how-to-check-if-a-variable-is-empty-in-python