pyexecjs js代码里使用外部python变量
见代码
hashsalt = re.findall(r'var hashsalt =(.*)', text.content.decode(),re.I)[0]
jso = """
function func(){
var hashsalt = hashsalt;
return hashsalt;
}
"""
要用到外部变量
可以像下面这样写
hashsalt = re.findall(r'var hashsalt =(.*)', text.content.decode(),re.I)[0]
print("-------------------", hashsalt)
jso = f"""
function func(){{
var hashsalt = {hashsalt};
return hashsalt;
}}
"""