> Fun fact: lots of JSON documents also evaluate as Python data structures. > So if you prepend "foo = <JSON>" and throw that into eval(), you can > magically evaluate a JSON document into a Python variable. Of course, > eval() is a security concern. But people blindly execute code in > mozilla-central (like the build system) all the time. So perhaps this is > tolerable.
from ast import literal_eval literal_eval does not execute code. Only accepts literals. Works in all Python versions. Please don't use eval! _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform