解决python爬虫问题:urllib.error.HTTPError: HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop.

报错的原始方法: 1)使用request.Request,出现上述错误。html无法爬取 from urllib import request def get_html(self, url): print(url) req = request.Request(url=url, headers={'U
posted @ 2021-11-19 07:54  张幼安  阅读(998)  评论(0编辑  收藏  举报