Python telegram bot || Can help with the bot, parser?

I did bot in a telegram to the sending of news from a particular site.
When you turn on the parser itself without the bot, it displays all the information from news feeds to the console, but when I turn the bot write command at Tg for information, it sends only one news. Fix my code and make it so he sent 5 or 10 news from the tape instead of one.
from bs4 import BeautifulSoup
import requests
import telebot

bot = telebot.TeleBot('config.token')
url = 'http://mignews.com/mobile'
page = requests.get(url)
new_news = []
soup = BeautifulSoup(page.text, "html.parser")
news = soup.findAll('a', class_='lenta')
for i in range(len(news)):
 if news[i].find('span', class_='time2 time3') is not None:
new_news.append(news[i].text)
for i in range(len(new_news)):

@bot.message_handler(commands=['start'])
 def start_message(message):
 bot.send_message(message.chat.id, 'Hello, you wrote me /start')


@bot.message_handler(content_types=['text'])
 def send_text(message):
 if message.text == 'news':
 bot.send_message(message.chat.id new_news[:5])
 elif message.text == 'News':
 bot.send_message(message.chat.id new_news[:5])


 bot.polling()
April 19th 20 at 12:29
1 answer
April 19th 20 at 12:31
Solution
It is necessary to send not new_news[:5], and
''.join(new_news[:5])
elif message.text == 'News':
bot.send_message(message.chat.id, ' '.join(new_news[:5]))

Ahem... I do not understand to be honest - Scottie91 commented on April 19th 20 at 12:34
@Scottie91, well, in the function send_message need to pass a string, not a list. The join function inserts '' between the list elements and returns a string - oliver.Funk45 commented on April 19th 20 at 12:37
@oliver.Funk45, but as I know in '' must be , or am I wrong ? - Scottie91 commented on April 19th 20 at 12:40
Friend , thank you , understood . Good luck in the future ! - Scottie91 commented on April 19th 20 at 12:43

Find more questions by tags TelegramPython