a dictionary from a list

Rocco Moretti roccomoretti at hotpop.com
Fri Jun 24 18:32:03 EDT 2005


David Bear wrote:
> I know there must be a better way to phrase this so google understands, but
> I don't know how.. So I'll ask people.
> 
> Assume I have a list object called 'alist'.
> 
> Is there an easy way to create a dictionary object with the members of
> 'alist' being the keys in the dictionary, and the value of the keys set to
> null?

Are you sure you need a dictionary? You may want to look at the Set 
module instead, if the values aren't important.



More information about the Python-list mailing list