On Nov 6, 8:11 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 6, 2008 at 12:04 PM, SimonPalmer <[EMAIL PROTECTED]> wrote:
> > Hi, I am looking for a way to convert a List of floating point numbers
> > to and from text.  I am embedding it in an XML document and am looking
> > for a neat way to serialise and de-serialise a list from a text node.
> > I can easily write something to do it manually but I wondered whether
> > List had native support to go to and from text.
>
> > If not List, are there any other collections/arrays that do this?
>
> It's not really a matter of the collection, but more a matter of
> serialization format/library.
>
> If you want the serialized representation to be human-readable, use
> JSON (http://docs.python.org/library/json.html#module-json).
> If that's not a requirement, use pickle
> (http://docs.python.org/library/pickle.html#module-pickle).
> Both modules can convert simple Python data, such as your list of
> floats, to a bytestream and back again.
>
> Cheers,
> Chris
> --
> Follow the path of the Iguana...http://rebertia.com
>
>
>
> > TIA
> > Simon
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
>

I looked at pickle, but the problem is that I want my XML to be
readable by languages other than python, so it sort of precludes it.
JSON would be perfect, but I think the module only exists in 2.6, is
that right?  Unfortunately I am bound to 2.4.

It is looking more and more like I am going to have to roll my own.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to