#1
  1. No Profile Picture
    inexperienced and useless
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Stevenage, uk
    Posts
    10
    Rep Power
    0

    Changing a list into a string??


    I want to write a list into a file within my cgi script. However I keep getting errors telling me that the arument must be a string or a read-only character buffer and not a list.

    Does anyone know how to change a list into a string?

    Thanks
  2. #2
  3. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    14
    Use pickle for serializing the contents of the list. The description of usage is found in the link above, but for speed you should use cPickle, which can be up to 1000 times faster, because it has been reimplemented in C iso Python.
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs

IMN logo majestic logo threadwatch logo seochat tools logo