add python string code in system module
kingangelAOA opened this issue · 0 comments
kingangelAOA commented
def importCode(code,name,add_to_sys_modules=0):
import sys,imp
module = imp.new_module(name)
print module.dict
exec(code,module.dict)
if add_to_sys_modules:
sys.modules[name] = module
return module
How to achieve by go-python?