基于urllib ImportError: cannot import name request的原因
1.urllib:的库中是没有request的这个方法的,所以请求数据中可以用urlopen
2.在vscodestudio点击crt+鼠标左键:查看urllib的方法
from urllib import urlopen
__all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve",
"urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus",
"urlencode", "url2pathname", "pathname2url", "splittag",
"localhost", "thishost", "ftperrors", "basejoin", "unwrap",
"splittype", "splithost", "splituser", "splitpasswd", "splitport",
"splitnport", "splitquery", "splitattr", "splitvalue",
"getproxies"]
url = "https://www.baidu.com/?tn=59044660_1_hao_pg"
get_url =urlopen(url)
每日遇到问题记录的一天2022-2-23 小小翟
|