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

Greg Ewing (using news.cis.dfn.de) wmwd2zz02 at sneakemail.com
Sun Mar 14 22:25:26 EST 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
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list