Sep-27-2022, 03:43 PM
(Sep-27-2022, 02:38 PM)DPaul Wrote: Can I now approach the pickle file and say "Give me the 7th object" ?I don't think you can do that. Pickle does not provide random access. The closest object that I can think of is the
persistent.list.PersistentList
class available in the zodb pakckage. It stores a persistent list of objects in pickle format and provides random access, but using zodb might be overkill for what you want to do. Another alternative is to use a shelve which is a persistent dictionary storing pickled objects, provided by the python standard library. I have not used shelve in the last 20 years and I found that it was slow the last time I did it.