我使用python3,并且urllib模块具有解析,错误,robotparse,只有它不会像import urllib.request和urllib.request.urlopen这样的命令,所以替代品或如何修复它
仔细阅读文档并使用它重新安装urllib,然后尝试或可以尝试使用此脚本
from urllib.request import urlopen
html = urlopen("http://www.google.com/").read()
print(html)
通常,建议使用最新的python http客户端-urllib3或请求
pip3 install urllib3
pip3 install requests
[如果您尝试使用其URL阅读网站内容,则可以通过请求来完成:
import requests
response = requests.get("https://stackoverflow.com/")
print(response.text)