I have a dictionary as:
default = {\'a\': [\'alpha\'], \'b\': [\'beta\',\'gamma\'], \'g\': []}
I wish to eliminate the empty values as:
One more option is the following (without creating a new dict):
for e in [k for k,v in default.iteritems() if len(v) == 0]: default.pop(e)