opposite of dict.items()

Tertius tcronj at ananzi.co.za
Thu Aug 28 17:56:08 EDT 2003


Peter Otten wrote:
> Tertius wrote:
> 
> 
>>Is there a method to create a dict from a list of keys and a list of
>>values ?
> 
> 
>>>>dict(zip(range(3), "abc"))
> 
> {0: 'a', 1: 'b', 2: 'c'}
> 
> Not a method() but a method.
> 
> Peter
> 
> 

much better than a for loop :)
thnx





More information about the Python-list mailing list