Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19870 > unrolled thread

Re: Help about dictionary append

Started byJames Broadhead <jamesbroadhead@gmail.com>
First post2012-02-05 15:21 +0000
Last post2012-02-05 15:21 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Help about dictionary append James Broadhead <jamesbroadhead@gmail.com> - 2012-02-05 15:21 +0000

#19870 — Re: Help about dictionary append

FromJames Broadhead <jamesbroadhead@gmail.com>
Date2012-02-05 15:21 +0000
SubjectRe: Help about dictionary append
Message-ID<mailman.5447.1328455302.27778.python-list@python.org>
On 5 February 2012 15:13, Anatoli Hristov <tolidtm@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).

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web