I am trying to check if a dictionary is empty but it doesn\'t behave properly. It just skips it and displays ONLINE without anything except of display the m
Here are three ways you can check if dict is empty. I prefer using the first way only though. The other two ways are way too wordy.
test_dict = {} if not test_dict: print "Dict is Empty" if not bool(test_dict): print "Dict is Empty" if len(test_dict) == 0: print "Dict is Empty"