操作
1 2 3 4
| pip install beautifulsoup4 -i https://mirrors.aliyun.com/pypi/simple/ pip install lxml -i https://mirrors.aliyun.com/pypi/simple/ pip install html5lib -i https://mirrors.aliyun.com/pypi/simple/ pip install chardet -i https://mirrors.aliyun.com/pypi/simple/
|
1 2 3 4 5 6 7 8 9 10 11 12
| import chardet from bs4 import BeautifulSoup import requests def loadTab1(): response = requests.get("https://wo", headers=headers) if response.status_code != 200: print('错误响应:', response.text) return response.encoding = requests.utils.get_encodings_from_content(response.text)[0] parsed_html = BeautifulSoup(response.text, from_encoding='utf-8') parsed_html.find() print(response.text)
|
本文地址: https://github.com/maxzhao-it/blog/post/f33d2bd5/