Help about dictionary append

James Broadhead jamesbroadhead at gmail.com
Sun Feb 5 10:21:18 EST 2012


On 5 February 2012 15:13, Anatoli Hristov <tolidtm at gmail.com> wrote:
> Hi there,
>
> I`m again confused and its the dictionary. As dictionary does not support
> append I create a variable list with dictionary key values and want to add
> new values to it and then copy it again to the dictionary as I dont know
> other methods.
>
> mydict =
> {'Name':('Name1','Name2','Name3'),'Tel':('023333','037777','049999')}
>

dicts are intended to be used differently from this;
more like:

name_tel = {}
name_tel['Name1'] = 023333
name_tel['Name2'] = 037777
print name_tel['Name1']

... where Name is the key used to retrieve the value (the telephone number).



More information about the Python-list mailing list