[Tutor] two lists to keys and values in dictionary

SA sarmstrong13@mac.com
Mon, 12 Aug 2002 13:28:42 -0500


On 8/12/02 1:22 PM, "SA" <sarmstrong13@mac.com> wrote:

>> 
> Here is another bit of a cludgeon:
> 
>>>> d={}
>>>> for k in l1:
> ...     for v in l2:
> ...             d[k]=v
> ... 
>>>> print d
> {'woo': 'hoo', 'wacky': 'hoo', 'wicky': 'hoo'}
> 
> 
> 


My bad. I just noticed that the output did not iterate properly over l2.

Sorry.


SA

-- 
"I can do everything on my Mac I used to on my PC. Plus a lot more ..."
-Me