D
D
Dunge2020-02-04 17:52:00
Python
Dunge, 2020-02-04 17:52:00

How to split string in vk_api in python?

In general, I know how to make an answer to the exact message, but let's say I want to make a command to the bot:! Say the text. But it's not clear to me how to make it so that he gets that text after the word! say

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Karbivnichy, 2020-02-04
@Dunge

command = '!скажи текст'
print(command[7:])
#текст

command2 = '!скажи много текста'
print(command2[7:])
#много текста

It's also possible like this:
command = '!скажи текст'
print(command.split(' ')[1])
#текст

or like this:
command = '!скажи текст'
print(command.replace('!скажи ',''))
#текст

addicts can do this:
command = '!скажи текст'
print((command[::-1][0:len(command[::-1])-7])[::-1])
#текст

Satanists do this:
import base64
command = '!скажи текст'
t = 'KGNvbW1hbmRbOjotMV1bMDpsZW4oY29tbWFuZFs6Oi0xXSktN10pWzo6LTFd'
print(eval(compile(base64.b64decode(t),'<string>', 'eval')))
#текст

S
Skid330, 2020-02-04
@Skid330

text = 'Hello world'
mtext = text.split(' ')
// mtext will be ['Hello', 'world']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question