【发布时间】:2017-08-11 16:34:45
【问题描述】:
我的代码如下;
source_code = requests.get(kale_url_keys)
plain_text = source_code.text
soup = BeautifulSoup("plain_text ")
或
r = requests.get(kale_url_keys)
html = r.content
soup = BeautifulSoup(html, "html.parser")
我在写下面这样的“soup = BeautifulSoup(ANYTHING)”时出错了;
或
【问题讨论】:
-
我看到你有 Python 3.6。
beautifulsoup4更新到最新版本了吗? -
Python 3.6。是的,我更新了 beautifulsoup4。
-
我无法用全新的 Win7 @ amd64 安装和 Python 3.6.0 重现它:(
-
请使用
python --version的输出更新您的答案。更新:您似乎必须将requests和urllib3更新到最新版本。你可以用pip来做。 -
Python 3.6.1rc1 。我已经更新了请求,bs4。
标签: python python-3.x web-scraping beautifulsoup html-table