python3 获取html中js的某一个变量,这个html中有多个script标签
时间: 2024-05-13 19:18:21
浏览: 147
可以使用Python中的BeautifulSoup库来解析HTML,然后使用[正则[表达](https://geek.csdn.net/educolumn/1410a16bee391aa5cfc33ba70e3247b7?spm=1055.2569.3001.10083)式](https://geek.csdn.net/educolumn/b04e5fff38104b983e9ace05416bf01b?dp_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NDQ0MDg2MiwiZXhwIjoxNzA3MzcxOTM4LCJpYXQiOjE3MDY3NjcxMzgsInVzZXJuYW1lIjoid2VpeGluXzY4NjQ1NjQ1In0.RrTYEnMNYPC7AQdoij4SBb0kKEgHoyvF-bZOG2eGQvc&spm=1055.2569.3001.10083)来[匹配](https://geek.csdn.net/educolumn/655404f4abb7011afbd1ee71e15d0286?spm=1055.2569.3001.10083)[javascript](https://geek.csdn.net/educolumn/3e427b9940783449029130030e9c9e62?spm=1055.2569.3001.10083)中的变量。具体[步骤](https://geek.csdn.net/educolumn/41e918968ef7840279c31b7f6a0950e3?spm=1055.2569.3001.10083)如下:
1. 安装BeautifulSoup库
pip install beautifulsoup4
```