D
D
daniel_IO2020-07-21 18:26:12
Python
daniel_IO, 2020-07-21 18:26:12

How to find out the number of lines in a VK message?

I am writing a bot for VK, and the question arose, how to find out the number of lines in a message? That is, not the number / n, but the lines that the user sees (on a PC)

for event in longpoll.listen():
 if event.type == VkBotEventType.MESSAGE_NEW:
  message = event.obj['message']
  text = message['text']
  strings = len('text')
  print(strings)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
HemulGM, 2020-07-21
@daniel_IO

5f171bd3c7815011996800.png
5f171bda4e5e4089197382.png

P
p1ugg, 2020-07-21
@p1ugg

find out where event.text.lower() is stored, usually it is msg, then print(len(msg))

S
soremix, 2020-07-21
@SoreMix

len(text.split('\n'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question