Dynamic append in a dictionnary object ...
Aahz Maruch
aahz at panix.com
Thu Mar 15 15:18:02 EST 2001
In article <3ab11de3$0$389$446d705c at news.skynet.be>,
Furax <constant.dupuis at swing.be> wrote:
>
>I'm pretty new to Python.
>I cannot figure out, reading the documentation, how I can dynamicaly add a
>new pair in a dictionnary ?
>>> d = {}
>>> d[1] = 'foo'
>>> d
{1: 'foo'}
>>> d['bar'] = 20
>>> d
{1: 'foo', 'bar': 20}
I suggest you work through the tutorial at
http://www.python.org/doc/current/tut/tut.html
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"The overexamined life sure is boring." --Loyal Mini Onion
More information about the Python-list
mailing list