String To List
george.sakkis at gmail.com
Mon Mar 17 10:58:59 CET 2008
On Mar 17, 3:22 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Girish <girish.... at gmail.com> 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.
More information about the Python-list