Inverse of dict(zip(x,y))

Andre Engels andreengels at
Thu Mar 5 19:46:01 CET 2009

On Thu, Mar 5, 2009 at 7:07 PM, psykeedelik <icymist at> wrote:

> I usually get properties that I compute, in a dictionary like property
> = [key1: val1, key2:val2, ...] and then I usually want to plot them in
> pylab, which AFAIK requires x and y as lists for the plot argument.
> Then I need to get the lists [key1, key2, ...] and [val1, val2, ...].
> And now I wonder if there a more efficient way doing what I described
> above!! ;)

If the dict = {key1: val1, key2: val2, ...}, you can do:

for key in dict:

André Engels, andreengels at

More information about the Python-list mailing list