Safe eval of insecure strings containing Python data structures?

franck pommereau at univ-paris12.fr
Thu Oct 9 14:22:33 CEST 2008


> I would like to parse arbitrary insecure text string containing nested
> Python data structures in eval-compatible form:  

Python 2.6 has ast.literal_eval to do exactly this. It handle lists,
tuples, dict, numbers, strings, bool and None, with arbitrary nesting.

Cheers,
Franck



More information about the Python-list mailing list