appending to dict

Hugh Macdonald hugh-m at moving-picture.com
Fri May 14 05:50:54 EDT 2004


On 14 May 2004 02:40:00 -0700
bucket79 at daum.net (bucket79) wrote:

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

a = {1:2}
a.update({3:4})



-- 
Hugh Macdonald
The Moving Picture Company




More information about the Python-list mailing list