求助帖:获取js里的变量
var now="https://baidu.com-ok-baidu.com/share/524e30e771dba8110c0241a0882023d0";var pn="kuyun"; var next="";var prePage="/play/55638-1-0.html";var nextPage="/play/55638-1-0.html";
我想拿到now的值,应该怎么弄?
var now="https://baidu.com-ok-baidu.com/share/524e30e771dba8110c0241a0882023d0";var pn="kuyun"; var next="";var prePage="/play/55638-1-0.html";var nextPage="/play/55638-1-0.html";
import re a="""var now="https://baidu.com-ok-baidu.com/share/524e30e771dba8110c0241a0882023d0";var pn="kuyun"; var next="";var prePage="/play/55638-1-0.html";var nextPage="/play/55638-1-0.html";""" print(a) s=re.findall(r'var (?P<name>\w+)=\"(?P<value>[^\"]+)\"',a) print(s) [('now', 'https://baidu.com-ok-baidu.com/share/524e30e771dba8110c0241a0882023d0'), ('pn', 'kuyun'), ('prePage', '/play/55638-1-0.html'), ('nextPage', '/play/55638-1-0.html')]