How to add pairs to a dict, typo corrected in this one.

Greg Ewing (using wmwd2zz02 at
Mon Mar 15 04:25:26 CET 2004

Avik Ghose wrote:
> If you have a dict called phone_book, when you get a new name_value pair 
> say 'tom' you can do.
> phone_book['tom'] = 33445511;

By the way, you may want to store your phone numbers
as strings rather than integers, just in case any
of them need to have leading zeroes...

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list