circuitpython/tests/basics/builtin_exec.py

7 lines
107 B
Python
Raw Normal View History

print(exec("def foo(): return 42"))
print(foo())
d = {}
exec("def bar(): return 84", d)
print(d["bar"]())