Код: Выделить всё
def get_profile_context(site_name):
"""Find the profile context based on the site name, case-insensitive."""
site_name = site_name.lower()
site_info = site_data[site_data['site_name'].str.lower() == site_name]
if not site_info.empty:
row = site_info.iloc[0]
context = (
f"- Enodeb ID: *{row['enodeb_id']}*\n"
f"- Site ID: {row['site_id']}\n"
f"- MC: {row['mc']}\n"
f"- TAC: {row['tac']}\n"
f"- Region: {row['region']}\n"
f"- Regency: {row['regency']}\n"
f"- Antenna Height: {row['antenna_height']}\n"
f"- Azimuth: {row['azimuth']}\n"
)
print(context)
global context_global
context_global = context
return context
else:
return "Site name not found."
async def button(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
if query.data == 'profile_site':
profile_context = get_profile_context(status["site_name"])
await query.edit_message_text(f"Profile of site '{status['site_name']}':\n{profile_context}")
keyboard = [
[InlineKeyboardButton("Back to Menu", callback_data='back_to_menu'),
InlineKeyboardButton("Back to Start", callback_data='start')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
await query.message.reply_text("What would you like to do next?", reply_markup=reply_markup)
Буду очень признателен за любую помощь!
Хочу ответ выделен жирным шрифтом :
Профиль сайта'--':
[*]Enodeb ID: 0000
Идентификатор сайта: 000000
[*]MC: MC
[*]TAC: 00
[*]Регион: СЕВЕРНО-ЦЕНТРАЛЬНЫЙ
[*]Регентство: город
[*]Высота антенны: 61
Азимут: 3_0
Подробнее здесь: https://stackoverflow.com/questions/790 ... legram-bot