Help about dictionary append

Andrew Berg bahamutzero8825 at gmail.com
Sun Feb 5 10:29:40 EST 2012


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



More information about the Python-list mailing list