On Mar 17, 3:22 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Girish <[EMAIL PROTECTED]> writes:
> > I have a string a = "['xyz', 'abc']".. I would like to convert it to a
> > list with elements 'xyz' and 'abc'. Is there any simple solution for
> > this??
> > Thanks for the help...
>
> Be careful about using eval, if the string came from a potentially
> hostile source.  Maybe what you really want is JSON, which has
> python-like syntax but a bunch of safe parsers.

Or take a look at a restricted safe eval variant  (e.g.
http://groups.google.com/group/comp.lang.python/browse_frm/thread/262d479569b1712e)

George
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to