[Tutor] passing dictionaries through a file

Ben Finney ben+python at benfinney.id.au
Tue Mar 17 01:33:48 CET 2015


"Doug Basberg" <dbasberg at comcast.net> writes:

> I would like to pass the contents of a dictionary from one program to
> another through a file.

The term for this in programming is “serialisation”, in the sense that a
specific series of bits will represent the Python value, and you want to
convert to and from that series of bits.

    <URL:https://en.wikipedia.org/wiki/Serialization>

More generally, having data values persist beyond the life of a program
is termed “persistence” of the data.

> So, what is the elegant way to pass a dictionary by file?

The Python standard library has several serialisation / persistence tools.

    <URL:https://docs.python.org/3/library/persistence.html>

-- 
 \      “Software patents provide one more means of controlling access |
  `\      to information. They are the tool of choice for the internet |
_o__)                                     highwayman.” —Anthony Taylor |
Ben Finney



More information about the Tutor mailing list