Inverse of dict(zip(x,y))
Paul McGuire
ptmcg at austin.rr.com
Wed Mar 4 10:51:17 EST 2009
On Mar 4, 5:33 am, Lie Ryan <lie.1... at gmail.com> wrote:
> Andre Engels wrote:
> > y = d.values() might also work, but I am not sure whether d.keys() and
> > d.values() are guaranteed to use the same order.
>
> If they were called immediately after each other I think they should,
> but better not rely on it.
I think this is why a solution based on d.items() is preferable - it
returns each key-value pair together.
-- Paul
More information about the Python-list
mailing list