How to append to a dictionary

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Fri May 19 08:08:55 EDT 2006


Harlin Seritt enlightened us with:
> I have some code here:
>
> groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'}
>
> I want to add another key: 'ITALIAN' : 'orange'
>
> How do I append this to 'groups'?

groups['ITALIAN'] = 'orange'

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list