Converting the keys of a dictionary from numeric to string

Peter Otten __peter__ at web.de
Thu Oct 20 04:23:04 EDT 2016


Paul Rubin wrote:

> Peter Otten <__peter__ at web.de> writes:
>> assert len(keydict) == len(mydict)
> 
> assert set(keydict) == set(mydict)

The weaker check is O(1), and, combined with the succeeding for loop, 
implies the above.




More information about the Python-list mailing list