[Tutor] python: how do I create a list of definitions?

Eric Brunson brunson at brunson.com
Fri Jul 20 01:47:57 CEST 2007


Tiger12506 wrote:
>> I don't understand dict
>>     
>
> Think of dict as a dictionary. Literally. You have a word, you look up it's 
> definition in the dictionary. A dictionary is made up of key, value pairs. 
> So for your example:
>
> a_dict = {2243 : 'e',
>                2234 : 'p',
>                2235 : 'lol',
>                'how' : 'under'}
>
> if x in a_dict:
>   string = string + a_dict[x]
>
>
>   

How can one get through any tutorial on Python and not come across dicts?

In more standard computer parlance a python dictionary is an associative 
array.





More information about the Tutor mailing list