On 2016-03-24, Steven D'Aprano <st...@pearwood.info> wrote:
> On Thu, 24 Mar 2016 09:49 pm, David Palao wrote:
>
>> Hi,
>> Use "eval":
>> s = "(1, 2, 3, 4)"
>> t = eval(s)
>
> Don't use eval unless you absolutely, categorically, 100% trust the source
> of the string.

And then still don't use it. :)

eval is only safe if you're passing it a literal string containing
nothing but a literal constant expression -- in which case the eval is
superflous.

OK, I admit I've used it for quick hacks on occasion.  But, I
shouldn't have.

-- 
Grant

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

Reply via email to