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


Groups > comp.lang.python > #19872

Re: Help about dictionary append

Date 2012-02-05 09:29 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: Help about dictionary append
References <CAKhY55NYDVe=TthHRe0-CaitRY-yawVvB-YPqOG8sOLkVvZ=+g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5449.1328455786.27778.python-list@python.org> (permalink)

Show all headers | 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