[Tutor] accessing list from a string
Kent Johnson
kent37 at tds.net
Wed Nov 26 03:24:36 CET 2008
On Tue, Nov 25, 2008 at 3:14 PM, Lie Ryan <lie.1296 at gmail.com> wrote:
> Instead, in python 2.6, you may use ast.literal_eval(). Which restrict
> the eval to literal syntax only, and prohibit any function calling.
That's very cool, thanks!
> Alternatively, for previous versions of python, or for more flexibility,
> you may use the safeeval like here: http://lybniz2.sourceforge.net/
> safeeval.html
It looks like it wouldn't be hard to port ast.literal_eval to Python 2.5...
Kent
More information about the Tutor
mailing list