#前提安装了node.js 并且设置环境变量 https://blog.csdn.net/bestyellow/article/details/119820509
import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, encoding='utf-8')
import execjs
def get_js_data(js_path,function_name,*args):
js_code = open(js_path, encoding='utf-8').read()
ctx = execjs.compile(js_code)

# 第一个参数为ja代码中的函数名, 后面为函数对应的参数
result = ctx.call(function_name,*args)
return result
# print(result)


posted on   我爱你的  阅读(14)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示