sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.52k stars 138 forks source link

add python string code in system module #90

Closed kingangelAOA closed 5 years ago

kingangelAOA commented 5 years ago

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?