Python
- 1 ответ
- 0 вопросов
0
Вклад в тег
import datetime
weekdays = {
1: "Понедельник",
2: "Вторник",
3: "Среда",
4: "Четверг",
...
}
today = datetime.date.today().isoweekday()
t = weekdays[today]
def foo_1(*args, **kwargs):
"""Твой код"""
...
def foo_2(*args, **kwargs):
"""Твой код"""
...
functions = {
"Понедельник": foo_1,
"Вторник": foo_2,
...
}
def func(message):
if message.text == "Расписание на сегодня":
today = datetime.date.today().isoweekday()
t = weekdays[today]
else:
t = message.text
functions[t]()