On Thu, Oct 14, 2010 at 3:02 PM, Sander Sweers <sander.swe...@gmail.com> wrote: > On 14 October 2010 20:29, David Hutto <smokefl...@gmail.com> wrote: >> Actually, I needed it to be converted to something without a string >> attached to it. See a post above, and it was fixed by eval(), > > Using eval is a big security risk and is generally not recommended for > any production code. What do you think eval() return for your string? > A tuple of ints which for your use case serves the same purpose as > using the list comprehension. > > If you really want (you really don't) to use eval() then at least use > the safe one from the ast mode. > >>>> from ast import literal_eval >>>> literal_eval(u'1,2,3,4') > (1, 2, 3, 4) >>>> eval(u'1,2,3,4') > (1, 2, 3, 4) > > As you can see for your use case both return a tuple of ints. > > Greets > Sander >
Thanks for pointing that out. I'll definitely note that for future reference, but this was for a somewhat personal data project app, So it's not necessary to worry about insertion of data other than my own inputs. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor