# 通用中文乱码的解决方案
img_name = img_name.encode('iso-8859-1').decode('gbk')
# 手动设置相应数据的编码格式
response = requests.get(url=url, headers=headers)
response.encoding = 'utf-8'
# text -> content
response.text 改成 response.content
requests.exceptions.SSLError: HTTPSConnectionPool(host='XXX', port=443)
问题cryptography
、pyOpenSSL
、certifi
三个模块即可pip install cryptography
pip install pyOpenSSL
pip install certifi
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate ver
requests.packages.urllib3.disable_warnings()
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 4 and head
原因在于html标签未加 / 所有的标签最好都用 / 来结束
TypeError: can only concatenate str (not “list”) to str
(列表和字符串的报错解决方法)# 强转即可
str(title)
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
# 是使用api过期导致此警告 使用这个(测试案例)即可
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service("chromedriver.exe")
driver = webdriver.Chrome(service=s)
driver.get('https://www.baidu.com/')
driver.quit()
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
# 使用标签的绝对定位
bro.find_element(By.XPATH,''
TypeError: ‘ItemMeta‘ object does not support item assignment
# 报错原因:未找到具体item,load出错,item后面需要加()进行实例化。
item = MeinvproItem()
redis.exceptions.DataError: Invalid input of type: 'dict'. Convert to a byte, string or number first.
# 使用旧版本pip install redis==2.10.6,即可解决
pip install autopep8
# 安装nbextensions
pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user
-------------------------------------------------------------------------------------------------------------------
# 安装nbextensions_configurator
pip install --user jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user
# 勾选Hinterland启用代码自动补全