Dict to "flat" list of (key,value)

Mike Rovner mike at nospam.com
Thu Jul 31 02:30:13 CEST 2003


Mike Rovner wrote:
> Nicolas Girard wrote:
>> Forgive me if the answer is trivial, but could you tell me how to
>> achieve the following:
>>
>> {k1:[v1,v2],k2:v3,...} --> [[k1,v1],[k1,v2],[k2,v3],...]
>
> [list(i) for i in d.items()]

Sorry, I missed v1,v2 flattening.








More information about the Python-list mailing list