Hi can anyone tell me how to remove empty keys in the following dictionary
d={'a':[],'b':,'c':[]}
I want it to be
d={'b':}
I tried this. But its showing error. I know its wrong to change the size of a dictionary during iteration. But is there any other way?
>>> for x in d:
... if d[x]==[]:
... del d[x]
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: dictionary changed size during iteration