如何解决给定网络爬虫中的意外 EOF 错误?

问题描述

目前,我正在自学网络抓取。

三天后,我掌握了 Beautifulsoup 单个查询的窍门,但我在 for....in 循环中挣扎以获得多个块。 >

这是我的设置:

import requests
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt

%matplotlib inline

quotes_url = 'http://quotes.toscrape.com/'

quotes_response = requests.get(quotes_url)

# Parse the whole HTML page using BeautifulSoup
soup = BeautifulSoup(quotes_response.text,'html.parser')


quotes = soup.find_all('div',class_quote)

在引号中引用:

我总是在 Google Colab 中收到此错误

文件“”,第3行 对于引号中的报价: ^ 语法错误:解析时出现意外的 EOF

例如,添加无关紧要。

quote_text = quotes.find('span',class_='text').text

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)