[英]Why json download with Python urllib.request is so slow? How can I make it faster?
[英]in my python 3 i cannot use urllib.request as it says i don't have this submodule so how can i access websites data?
我使用 python3 和 urllib 模塊有解析,錯誤,robotparse 只是它沒有像 import urllib.request 和 urllib.request.urlopen 這樣的命令,所以有什么替代品或如何修復它
go 通過文檔並使用它重新安裝 urllib 然后嘗試,或者您可以嘗試使用此腳本
from urllib.request import urlopen
html = urlopen("http://www.google.com/").read()
print(html)
一般來說,建議使用最新的 python http 客戶端 - urllib3 或 requests
pip3 install urllib3
pip3 install requests
如果您嘗試使用其 URL 閱讀網站內容,您可以通過請求來完成:
import requests
response = requests.get("https://stackoverflow.com/")
print(response.text)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.