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


Groups > comp.lang.python > #19872

Re: Help about dictionary append

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'cpython': 0.05; 'attribute': 0.07; 'append': 0.09; 'tuple': 0.09; 'am,': 0.12; '9:13': 0.16; 'tuple,': 0.16; 'subject:Help': 0.17; 'wrote:': 0.18; "aren't": 0.21; 'received:209.85.210.174': 0.21; 'received :mail-iy0-f174.google.com': 0.21; 'header:In-Reply-To:1': 0.22; '(or': 0.22; 'dictionary': 0.23; 'defined': 0.24; 'windows': 0.26; 'tuples': 0.30; 'error': 0.30; 'url:library': 0.31; 'message- id:@gmail.com': 0.31; 'values': 0.32; 'change.': 0.32; 'supposed': 0.32; 'list': 0.32; 'there': 0.33; 'header:User-Agent:1': 0.33; 'object': 0.33; 'to:addr:python-list': 0.35; 'url:python': 0.35; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'received:192': 0.38; 'received:192.168.1': 0.39; 'url:org': 0.39; 'received:209': 0.39; 'change': 0.40; 'to:addr:python.org': 0.40; '!!!': 0.64; 'ever': 0.64; 'here:': 0.67; 'delete,': 0.84; 'items,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=itk7u76mfK0MMsxKvG9+X/x9orQF81NRl9pYAhs0rUI=; b=LogU6+GJaS0qojwXJUS+8bDTCsVcftk9IDbTkwH3//6esxAhXg3QkvDXygYcL4NMWD 2DQjz1go7n+bsA0zbRVMkNPdcfQVFidRvFzuNqrQhqcSMuEl9sk5w0FWrmukyHmyguji k7YT9A+o6CWCsEaMlIUdGjC6OyORhhEP0vYAw=
Date Sun, 05 Feb 2012 09:29:40 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111220 Thunderbird/9.0
MIME-Version 1.0
To "comp.lang.python" <python-list@python.org>
Subject Re: Help about dictionary append
References <CAKhY55NYDVe=TthHRe0-CaitRY-yawVvB-YPqOG8sOLkVvZ=+g@mail.gmail.com>
In-Reply-To <CAKhY55NYDVe=TthHRe0-CaitRY-yawVvB-YPqOG8sOLkVvZ=+g@mail.gmail.com>
X-Enigmail-Version 1.3.5
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
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.5449.1328455786.27778.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328455786 news.xs4all.nl 6868 [2001:888:2000:d::a6]:45422
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19872

Show key headers only | View raw


On 2/5/2012 9:13 AM, Anatoli Hristov wrote:
> and I get and error that TUPLE object has no attribute Append !!!
You defined mydict['name'] as a tuple, and tuples are immutable. Using a
tuple means that you don't ever want the values to change.

> But how to add new Values to a dictionary then ?
This has nothing to do with dictionaries. If you want to add, delete, or
change items, use a list (or a set if there aren't supposed to be any
duplicates). Information on built-in types is here:

http://docs.python.org/library/stdtypes.html (2.7)
http://docs.python.org/py3k/library/stdtypes.html (3.2)

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640

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


Thread

Re: Help about dictionary append Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-05 09:29 -0600
  Re: Help about dictionary append "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2012-02-06 00:26 -0800

csiph-web