import js2py # 实例化一个执行js的环境对象 context_js_obj = js2py.EvalJs() js_str = """ function A(a,b){ return a+b } """ # 传递js_str,执行js context_js_obj.execute(js_str) result = context_js_obj.A(1, 2) print(result) # 创建变量 context_js_obj.num = 30 print(context_js_obj.num)
原文地址:https://www.cnblogs.com/ls1997/p/11291812.html
时间: 2024-10-08 03:22:05