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


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

Re: Help about dictionary append

Started byAndrew Berg <bahamutzero8825@gmail.com>
First post2012-02-05 09:29 -0600
Last post2012-02-06 00:26 -0800
Articles 2 — 2 participants

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

#19872 — Re: Help about dictionary append

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2012-02-05 09:29 -0600
SubjectRe: Help about dictionary append
Message-ID<mailman.5449.1328455786.27778.python-list@python.org>
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

[toc] | [next] | [standalone]


#19937

From"bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com>
Date2012-02-06 00:26 -0800
Message-ID<8017354d-3766-4c20-96f0-259b9b1a7274@f30g2000yqh.googlegroups.com>
In reply to#19872
On Feb 5, 4:29 pm, Andrew Berg <bahamutzero8...@gmail.com> wrote:
> 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).

AND you don't care about ordering...

[toc] | [prev] | [standalone]


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


csiph-web