When compiling this code (in Sublime Text):
import requests from bs4 import BeautifulSoup user_id = 12 url = 'https://www.kinopoisk.ru/' r = requests.get(url) with open('news.html', 'w') as output_file: output_file.write(r.content.decode('cp1251')) with open('news.html') as input_file: text = input_file.read() result = [] soup = BeautifulSoup(text, 'html.parser') news_list = soup.find('div', {'class' : 'newsList newsList_main'}) items = news_list.find('div', {'class' : 'item item_link'}) for item in items: name_new = item.find('div', {'class' : 'title'}).find('a').text result.append(name_new) Displays error:
Traceback (most recent call last): File "pylab3_2.py", line 18, in <module> name_new = item.find('div', {'class' : 'title'}).find('a').text TypeError: slice indices must be integers or None or have an __index__ method