R
R
ripjakeyh2019-06-12 18:16:15
Python
ripjakeyh, 2019-06-12 18:16:15

How to cut the VK page ID from the command using a regex (Python)?

vk_api library

if event.type == VkBotEventType.MESSAGE_NEW and event.obj.text.lower() == "/stats" or event.obj.text.lower() == "/статистика":

As an example / stats 1
(Under the number from means the id of the person, in our case Durov)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Michurin, 2019-06-12
@ripjakeyh

You can do it without regex, something like this

command = '/stats 1'
vk_id =  command.split(" ")[1]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question