appending to dict
Heather Coppersmith
me at privacy.net
Fri May 14 08:52:37 EDT 2004
On 14 May 2004 02:40:00 -0700,
bucket79 at daum.net (bucket79) wrote:
> is there anyway appending to dictionary?
> list has this feature
>>>> a = []
>>>> a.append(1)
>>>> print a
> [1]
> but dictionary can't
> i wanna do like this thing
>>>> a = {1, 2}
>>>> a.append(3, 4) -> This is just my idea :@
>>>> print a
> {1:2, 3:4}
Maybe I'm missing something. Try this:
a = { 1:2 }
a[ 3 ] = 4
and then check out
http://www.python.org/doc/current/tut/node7.html#SECTION007400000000000000000
and
http://www.python.org/doc/current/lib/typesmapping.html
HTH,
Heather
--
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli
More information about the Python-list
mailing list