[Tutor] Re: question

Andrei project5 at redrival.net
Mon Feb 9 12:38:58 EST 2004

Dennis wrote on Mon, 9 Feb 2004 15:02:18 +0100:

> I work with Python 2.3.3 and I try to make a programme that saves
> words in a dictionary. And because I'm not a Python expert I don't know
> how to do it or witch command I need. Could you please send me an example
> of this case? 

A dictionary looks like this:
mydict = {}
You can add a key-value pair to it like this:
mydit["key"] = "value"

For storing you should look into file(), str() and eval() - not particulary
safe, but ok for private use - or something with pickle.

Otherwise this sounds somewhat like a homework assignment, so I won't give
full working code :).



Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.

More information about the Tutor mailing list