[Tutor] would pickle or cpickle help?

Ertl, John john.ertl at fnmoc.navy.mil
Thu Jun 30 23:32:24 CEST 2005


All,

I have a text file that contains several thousand lines of space delimited
text that contain a ship ID and a ship name.  This file is updated every few
months.

I have another file that contains the ship ID and some other info but not
the ship name.  I have to append the ship name to the end of the line.  Easy
enough.

I currently make a dictionary of the shipID(key) and ship name(value) and
use this to append the ship name to the end of the line that contains the
ship ID.

Could I use something like cpickle to store the dictionary once it is made
so I would not have to make it each time?  I have never tried to use pickle
so I am bit fuzzy on what it can store and what it can't.  Also would it
really buy me anything...it only takes a second or two to make the
dictionary? There is a chance the file that I use to make the dictionary
will eventually grow to be 10,000 lines or more.

Thanks for the ideas.

John Ertl


More information about the Tutor mailing list