K
K
Kto Takoi2021-10-06 14:47:28
Python
Kto Takoi, 2021-10-06 14:47:28

How to split a telegram message?

Karoch, this is the problem, I receive messages and want to parse them through the bot, but for this you need to cut them line by line. For example, the message is:
Hello
, How are you?
What are you doing?

And it comes with 1 message and not many, how can I divide them and put them in a variable. For example a is line 1, b is line 2, and so on.
library used by PyTelegramBotApi

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Shevkunov, 2021-10-06
@Realno_cheal

Line break is \n
so del a = text.split('\n')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question