On Mon, 08 May 2006 00:44:39 -0700, micklee74 wrote: > i have a list with contents like this > alist = ['>QWER' , 'askfhs', '>REWR' ,'sfsdf' , '>FGDG', > 'sdfsdgffdgfdg' ] > > how can i "convert" this list into a dictionary such that > > dictionary = { '>QWER':'askfhs' , '>REWR' : 'sfsdf' , '>FGDG', > 'sdfsdgffdgfdg' }
This strikes me as a little bit voodish, but you could do: dictionary = dict(zip(alist[::2], alist[1::2])) -- http://mail.python.org/mailman/listinfo/python-list