[Tutor] Generating a python file

Peter Otten __peter__ at web.de
Tue Dec 14 13:06:04 CET 2010


C.T. Matsumoto 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.

For simple human-readable dictionaries the established format is json, see

http://docs.python.org/library/json.htm

json files look similar to python dictionaries, but there are libraries to 
read or write them for other programming languages, too.

Peter



More information about the Tutor mailing list