Answer the question
In order to leave comments, you need to log in
How to create keyboard buttons in a loop?
keyboard = types.ReplyKeyboardMarkup(row_width=4, resize_keyboard=True)
for but in ['Кнопка 1', 'Кнопка 2', 'Кнопка 3']:
keyboard.add(*[types.KeyboardButton(name) for name in[ but ]])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question