def get_params(text):
commands = [
"/start",
"/end",
"/exit"
]
for command in commands:
if command in text:
return command, text.split(command)[1].strip()
return None, text
>>> get_params("/start 23432 sdf")
('/start', '23432 sdf')
>>> get_params("/end 23432 sdf")
('/end', '23432 sdf')
>>> get_params("23432 sdf")
(None, '23432 sdf')
>>> get_params("/start")
('/start', '')