How to add pairs to a dict, typo corrected in this one.
Avik Ghose
avikghose at yahoo.co.in
Fri Mar 12 03:50:15 EST 2004
Hi Anthony,
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;
In order to check for duplicates you can do something like
if 'tom' in phone_book.keys():
#duplicate entry;
else:
#new entry
Hope that helps.
Thanks and regards,
Avik Ghose
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040312/ea458a12/attachment.html>
More information about the Python-list
mailing list