Answers for "to check weather a dictionary is empty or not in python"

0

to check weather a dictionary is empty or not in python

my_dict = {}

if not bool(my_dict):
    print("Dictionary is empty")
Posted by: Guest on June-01-2021
0

to check weather a dictionary is empty or not in python

empty_dict = {}
 
if empty_dict:
    print('Dictionary is not empty!')
else:
    print('Dictionary is empty!')
Posted by: Guest on October-17-2021

Code answers related to "to check weather a dictionary is empty or not in python"

Browse Popular Code Answers by Language