eval() == evil? --- How to use it safely?

castironpi castironpi at gmail.com
Thu Aug 28 19:42:39 EDT 2008


On Aug 28, 4:51 pm, Fett <FettMan... at gmail.com> wrote:
> I am creating a program that requires some data that must be kept up
> to date. What I plan is to put this data up on a web-site then have
> the program periodically pull the data off the web-site.
>
> My problem is that when I pull the data (currently stored as a
> dictionary on the site) off the site, it is a string, I can use eval()
> to make that string into a dictionary, and everything is great.
> However, this means that I am using eval() on some string on a web-
> site, which seems pretty un-safe.

May I suggest PyYAML?



More information about the Python-list mailing list