I use eval('string') in a python script to execute a piece of java scrit, and I would like to store the string in a xml and then parse use element tree as text string, the problem is in this way, the eval() will return nothing since the parsed string is a string object not a original string which can be reconigized by eval(), anybody knows how to solve this problem? I am a freshman on programming, any suggestions will be highly appriciated.
You probably shouldn't use eval... But to answer your question on how to store an object to be later executed but eval, you do repr(my_object), this will often return a string, suitable for eval, but this is not always true.
element tree parse xml text string to be called by eval