一、拿到函数返回值
匿名函数,与有名函数均可;
import PyV8
with PyV8.JSContext() as ctxt:
func = ctxt.eval('''(function(){return '###'})''')
print(func)
例如:
import PyV8
with PyV8.JSContext() as ctxt:
func = ctxt.eval("""((function(){var a\x3d2003310650;var b\x3d-1936257561;return 425365+\x27.\x27+(a+b)})());""")
print(func)
执行结果:425365.67053089
二、拿到变量值: