说短期,如果我有宠物小精灵列表:查找Python字典
not_e = {"Bulbasaur": ["Overgrow", "Tackle", "Leech Seed"],
"Charmander": ["Blaze", "Scratchy", "Growl"],
"Squirtle": ["Torrent", "Tackle", "Tail Whip"],
"Pikachu": ["Static", "Tail Whip", "Thunder Shock"],
"Haunter": ["Levitate", "Hypnosis", "Spite"],}
并说如果我想选择一个随机宠物小精灵,我这样做:
random_pokemon = ["Bulbasaur", "Charmander", "Squirtle", "Pikachu", "Haunter"]
rand_pokemon = random.choice(random_pokemon)
print("Your pokemon is: " + rand_pokemon)
会如何我在那本词典中搜索随机口袋妖怪,并从中获得权力列表?
为什么'not_e [rand_pokemon]'? – ton1c