Tuesday, October 19, 2010

How to append a dictionary in Python

groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'}
# if you want to later add a new one, i.e., 'ITALIAN' : 'orange'

groups['ITALIAN'] = 'orange'

No comments: