Peng Yu wrote:
Does anybody know what is the correct way to evaluation python
code that contains `def`? Thanks.

Here's one way to do it:

   env = {}
   exec(s, env, env)

Now env['f'] contains the defined function, which you can then
call, disassemble or whatever you want.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to