encoding and decoding repr'd version of strings

Daniel Parisien dan at eevolved.com
Mon Jun 3 13:43:58 EDT 2002


Hi 
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!)

Thanks,
Dan



More information about the Python-list mailing list