[Tutor] Generating a python file

Albert-Jan Roskam fomcl at yahoo.com
Tue Dec 14 10:09:39 CET 2010


If it's specifically about a dictionary, try also the following:
import shelve

A shelve is a persistent dictionary.

All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have the 
Romans ever done for us?

From: शंतनू <shantanoo at gmail.com>
To: C.T. Matsumoto <c.t.matsumoto at gmail.com>
Cc: python-tutor <tutor at python.org>
Sent: Tue, December 14, 2010 9:54:00 AM
Subject: Re: [Tutor] Generating a python file

On Tue, Dec 14, 2010 at 14:18, C.T. Matsumoto <c.t.matsumoto at gmail.com> wrote:

>Is it possible to create files containing python code in the same sort of way 
>that you can generate text files.
>A simple example perhaps could be a persistent dictionary. Keys and values are 
>written to the dictionary in a file, that can be imported later.

http://docs.python.org/library/pickle.html is your friend.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101214/6940a30a/attachment.html>

More information about the Tutor mailing list