list to dict

Denis S. Otkidach ods at strana.ru
Thu Jun 17 12:51:36 EDT 2004


On Wed, 16 Jun 2004, Yermat wrote:

Y> > What is the easiest/fastest way to build a dictionary from
Y> a list? The
Y> > list contains 100,000 entries.
Y> >
Y> > Thanks,
Y> > Bart
Y>
Y>  >>> dict([(1,'a'),(2,'b')])
Y> {1: 'a', 2: 'b'}
Y>
Y> list of tuples -> dict !

But unfortunately list({1: 'a', 2: 'b'}) -> [1, 2].

-- 
Denis S. Otkidach
http://www.python.ru/      [ru]





More information about the Python-list mailing list