| user_id | op_id |
+---------+-------+
| 123 | op1 |
| 4324 | op2 |
| 34234 | op3 |
SELECT user_id from test group by op_id
| user_id |
+---------+
| 123 |
| 4324 |
| 34234 |
ops = {f'op_{i}': user_id[0] for i, user_id in enumerate(cur.fetchall(), 1)}
{'op_1': 123, 'op_2': 132123, 'op_3': 23434}
list_buttons_datas = [
('button 1', 'callback_data_1'),
('button 2', 'callback_data_2'),
('button 3', 'callback_data_3')
]
buttons_list = []
for name, data in list_button_name:
buttons_list.append([InlineKeyboardButton(text=name, callback_data=data)])
keyboard_inline_buttons = InlineKeyboardMarkup(inline_keyboard=buttons_list)
list_buttons_datas = [
('button 1', 'callback_data_1'),
('button 2', 'callback_data_2'),
('button 3', 'callback_data_3')
]
# кол-во кнопок в ряду v
keyboard_inline_buttons = InlineKeyboardMarkup(row_width=1)
for name, data in list_button_name:
keyboard_inline_buttons.add(InlineKeyboardButton(text=name, callback_data=data))
if value == 'Доллар [USD]':
elif value == 'Евро [EUR]':
else:
заменить на match-casematch value:
case 'Доллар [USD]':
...
case 'Евро [EUR]':
...
...
case _: # аналог else
return 'произошла ошибка'
USD_URL = 'https://www.google.com/search?q=...'
EUR_URL = 'https://www.google.com/search?q=...'