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

Mike Rovner mike at nospam.com
Wed Jul 30 20:30:13 EDT 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