python dictionary note point

--from <fluent phthon> 

This is why modifying the contents of a dict while iterating through it is a bad idea. If you need to scan and add items to a dictionary, do it in two steps: read the dict from start to finish and collect the needed additions in a second dict. Then update the first one with it

猜你喜欢

转载自www.cnblogs.com/cometous/p/10434967.html