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

Mike Rovner mike at nospam.com
Wed Jul 30 20:02:42 EDT 2003


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()]

Mike








More information about the Python-list mailing list