File record separators.

Grant Edwards grante at visi.com
Tue May 15 12:03:08 EDT 2007


On 2007-05-15, HMS Surprise <john at datavoiceint.com> wrote:

> I need to write 2 member lists to a file. For each record the number
> of these lists can be different. I think a good way to handle that may
> be to make each record a list of lists. I am restricted to using
> version 2.2. That being the case what is a good standard record
> separator to use to ensure that I read in one record (list of lists)
> at a time, '\n'? I want to try to stay with what is considered
> standard python idioms.

Your description is a bit vague, but if I'm guessing your task
correctly, the standard idiom is to use the pickle module:

  http://www.python.org/doc/2.2.3/lib/module-pickle.html

You can use it to write pretty much any python object to a file.

-- 
Grant Edwards                   grante             Yow! Nipples, dimples,
                                  at               knuckles, NICKLES,
                               visi.com            wrinkles, pimples!!



More information about the Python-list mailing list