> Hi all.
> 
>  I have 2 lists,
>  a = [1,2,3]
>  b = ["ooo","aaa","ppp"]
> 
>  What is the fastest way to make a dict like {1:"ooo",2:"aaa",
> 3:"ppp"} ?
> 
> Thanx

>>> dict(zip(a,b))
{1: 'ooo', 2: 'aaa', 3: 'ppp'}

works for me, but not sure, if it is the fastest way; a, b have to be of the 
same length, otherwise the shorter is used.

vbr
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to