python-js加载-js2py

简单记录一下js2py

import js2py

#将代码封装成函数,执行后返回值
script = ''' '''
script = 'function getList(){' + script + 'return  msgList  \n}'
#script = script + 'let getList = () =>msgList;'
getList = js2py.eval_js(script)```

#第二种方式,可获取到变量值
script="""
var text = 1;
"""
context = js2py.EvalJs()
context.execute(script)
text=context.text # 将guid1传递到Python中
print(text)

你可能感兴趣的:(python模块)