is_empty
Python package to check whether a variable is empty or not.
Description
- The package has two functions named
empty()
andnot_empty()
which can check if a variable is empty or not. - The following values evaluate to empty:
- 0
- 0.0
- ""
- None
- False
- []
- ()
- {}
- set()
- b""
Installation
To install, write the following command in your terminal.
pip install is_empty
Examples
Import the functions to your code.
from is_empty import empty, not_empty
- Check whether a list is empty or not using empty().
#The function will return True in this case
items = []
if empty(items):
#Do something
else:
#Do something else
- Check whether a tuple is not empty using not_empty.
#The function will return True in this case
items = (1,2,3)
if not_empty(items):
#Do something
Author
Wahid Sadique Koly
License
This project is licensed under the MIT License - see the LICENSE file for details