-2

so i have a list of names like:

XX1
XX2
XX3
XZ1
XZ2 

divided by brands , like:

Atlas

    XX1
    XX2
    XX3

Tediore

    XZ1
    XZ2

after this I would like to print only the specific weapon of the requested brand chosen by the user:

elif text.startswith('/weapon'):
    keyboard = InlineKeyboardMarkup(inline_keyboard =[[InlineKeyboardButton(text='Atlas', callback_data='Atlas')],
                                                      [InlineKeyboardButton(text='Tediore', callback_data='tediore')],
                                                      [InlineKeyboardButton(text='DAHL', callback_data='DAHL')],])
bot.sendMessage(msg_data['chat_id'],"Select the brand ?",reply_markup = keyboard )

Any ideas?

Abra
  • 19,142
  • 7
  • 29
  • 41
Vaykor MIP
  • 129
  • 1
  • 8

1 Answers1

1

I am not entirely sure what you are shooting for but you could use a nested dictionary strategy with the brand being keys for the first level and tags like 'weapon' being the second level. e.g.

myBrands={'brand1':{'weapon':brandOneWeapon}}

So that when you call myBrands you can use the keys to obtain only what you want.

currentWeapon=myBrands['brand1']['weapon']
print(currentWeapon)
sokato
  • 354
  • 4
  • 14