How to check if dictionary is empty or not? more specifically, my program starts with some key in dictionary and I have a loop which iterates till there are key in dictionary. Overall algo is like this:
Start with some key in dict
while there is key in dict
do some operation on first key in dict
remove first key
Please note that some operation
in above loop may add new keys to dictionary.
I've tried
for key,value in d.iteritems()
but it is failing as during while loop some new key are added.
if dict
should check for emptiness. – squiguy