Most probably a stupid question, but I still want to ask

Stephen Hansen me+python at ixokai.io
Mon Apr 11 00:46:58 EDT 2016


On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote:
> and the (almost always to be avoided) use of eval()

FWIW, there's ast.literal_eval which is safe and there's no reason to
avoid it. You'll still have to deal with the fact that a single string
on a line will return a string while multiples will return a tuple, but
how you're doing that (checking the type of the result) is fine.

--Stephen
m e @ i x o k a i . i o



More information about the Python-list mailing list