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


Groups > comp.lang.python > #19870

Re: Help about dictionary append

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jamesbroadhead@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'append': 0.09; 'cc:addr :python-list': 0.16; 'subject:Help': 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'received:209.85.210.174': 0.21; 'received :mail-iy0-f174.google.com': 0.21; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; 'cc:2**0': 0.26; 'variable': 0.28; 'message- id:@mail.gmail.com': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.29; 'confused': 0.30; 'differently': 0.30; '(the': 0.30; 'values': 0.32; 'does': 0.32; 'list': 0.32; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; 'more': 0.61
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=5M9kqHAWF5KPXz3BBpVhp+DjdeA4NqwNCKV+AU9DxIk=; b=pf1E+ge6HXRUPZ9jrnPQnG+nYqwXgf+Vhu/1c68aVjnSpy9+u9gXarg1w6meLDCPk1 RoFT2ZpSpmiLshYLvDZd8XJAbQOWZw+kWI0oZeraNhXR+eOg5njtWAZCur+wbd89UzOR 2hJFhqUgGZE+MrbTx78jw/XeMlGUmAg8Ie4/M=
MIME-Version 1.0
In-Reply-To <CAKhY55NYDVe=TthHRe0-CaitRY-yawVvB-YPqOG8sOLkVvZ=+g@mail.gmail.com>
References <CAKhY55NYDVe=TthHRe0-CaitRY-yawVvB-YPqOG8sOLkVvZ=+g@mail.gmail.com>
From James Broadhead <jamesbroadhead@gmail.com>
Date Sun, 5 Feb 2012 15:21:18 +0000
Subject Re: Help about dictionary append
To Anatoli Hristov <tolidtm@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5447.1328455302.27778.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328455302 news.xs4all.nl 6852 [2001:888:2000:d::a6]:57050
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19870

Show key headers only | View raw


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).

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web