import requestsfrom bs4 import BeautifulSoup# 定义目标网页的URLurl = httpwwwdongniccvodshow1178html# 发起HTTP请求response = requestsgeturlheaders = user-agent Mozilla50 Windows NT 100; Win64; x64 AppleWebKit
在代码的第14行,使用了一个未定义的变量params。根据代码的逻辑,这个变量应该是用于传递请求参数的,但是在代码中没有定义和赋值。因此,可以将第14行的代码修改为:
response = requests.get(url=url, headers=headers)
这样就可以解决这个错误。
原文地址: http://www.cveoy.top/t/topic/ieEu 著作权归作者所有。请勿转载和采集!