encoding and decoding repr'd version of strings
dan at eevolved.com
Mon Jun 3 20:37:34 CEST 2002
Gustavo Cordova wrote:
>> is there an codec that bundles with python so you can
>> transform strings into the repr'd (escaped) version and
>> back? If not, how easy would it be to code? I don't want
>> to use eval(...) because I don't trust the source of the
>> string and I might mistakenly eval an expression like "'
>> '*(2**30)" which would allocate about 1 GB of data (eek!)
> I might be going out on a limb here, but how about using pickle
> or cpickle?
Valid suggestion, but it's a lot of overhead for naught (I just want to
store escaped strings, not data of all types). It's also a little too
More information about the Python-list