![](/img/trans.png)
[英]urlopen doesn't appear to work depending on how input text is generated
[英]urlopen doesn't work to connect to website
只是學習使用 python 編碼並嘗試一些基本的網絡抓取。 我已經在我的系統上安裝了 python 3.9 和 Anaconda,並安裝了一些 pip 庫。
這是我的代碼:
# Import requests (to download the page)
#pip install requests
import requests
import urllib3
# Import BeautifulSoup (to parse what we download)
#pip install BeautifulSoup4
from bs4 import BeautifulSoup as soup
http = urllib3.PoolManager()
r = http.request('GET', 'http://google.com')
page_html = r.read()
r = soup(page_html, "html.parser")
print(r)
但是,這是我得到的錯誤:
Blank (literally blank line)
[Finished in 0.9s]
任何幫助,將不勝感激! 我已經在谷歌上搜索了幾個小時無濟於事..
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.