“RuntimeError: dictionary changed size during iteration” error
d={'a':[1],'b':[1,2],'c':[],'d':[]}foriind:ifnotd[i]:d.pop(i)更改InPython2.xcallingkeysmakesacopyofthekeythatyoucaniterateoverwhilemodifyingthedict:foriind.keys():Notethatthisdoesn'tworkinPython3.xbecau