Question about ast.literal_eval

Mark Lawrence breamoreboy at yahoo.co.uk
Tue May 21 05:00:48 EDT 2013


On 21/05/2013 09:23, Fábio Santos wrote:
>
> On 21 May 2013 09:10, "Frank Millman" <frank at chagford.com
> <mailto:frank at chagford.com>> wrote:
>  > It doesn't address the issue of brackets. I imagine that the answer
> is something like -
>  >
>  >   maintain a stack of results
>  >   for each left bracket, push a level
>  >   for each right bracket, pop the result
>  >
>  > or something ...
>  >
>
> Time for me to suggest pyparsing or PLY. You're better off creating your
> own AST and walking it to produce python or SQL than reinventing the
> wheel, I think.
>

Or pick one from this lot http://nedbatchelder.com/text/python-parsers.html

-- 
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.

Mark Lawrence




More information about the Python-list mailing list