1.安装
pip install PyExecJS
2.使用
import execjs
# 测试
js_file = open('sjtest.js', 'r')
js_str = js_file.read()
js_file.close()
#print(js_str)
ctx = execjs.compile(js_str)
ctx.call("enString", 'qaz')
3.sjtest.js文件
function enString(data){
var key1 = "qwer";
var key2 = "asd";
var key3 = "123";
var enchex = key1+key2+key3+data
return enchex;
}