On Apr 23, 4:22 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Apr 23, 6:24 pm, Daniel <[EMAIL PROTECTED]> wrote:
>
> > I have a list of strings, which I need to convert into tuples.  If the
> > string is not in python tuple format (i.e. "('one', 'two')", "("one",
> > 'two')", etc.), then I can just make it a 1-tuple (i.e. return
> > (string,) ).  If it is in python tuple format, I need to parse it and
> > return the appropriate tuple (it's ok to keep all tuple elements as
> > strings).
>
> > I think eval() will work for this, but I don't know what will be in
> > the string, so I don't feel comfortable using that.
>
> Check out one of the safe restricted eval recipes, 
> e.g.http://preview.tinyurl.com/6h7ous.
>
Thank you very much!
> HTH,
> George

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

Reply via email to