Немогу понять в чем ошибка
Вот сайт
import requests
from bs4 import BeautifulSoup as bs
import csv
url = 'http://quotes.toscrape.com/'
response = requests.get(url)
html_data = bs(response.text, "html.parser")
quotes = html_data.find_all(class_="quote")
with open('phrases.csv', 'w') as file:
headers_list = ['Text', 'Author', 'tags']
csv_writer = csv.DictWriter(file, fieldnames=headers_list)
csv_writer.writeheader()
for i in range(len(quotes)):
if i == 6:
print(quotes[1].find(class_='author').get_text())
csv_writer.writerow({
'Text': quotes[i].find(class_='text').get_text(),
'Author': quotes[i].find('small', class_='author').get_text(),
'tags': quotes[i].find(class_='keywords')['content']
})
В цикле for, когда i доходит до 6, выходит ошибка UnicodeEncodeError: 'charmap' codec can't encode character '\xe9' in position 87: character maps to <undefined>