所以基本上我有一本字典,我们称它为a
a = {1: {'hero': 'Anti-Mage', 'vert': 'http://cdn.dota2.com/apps/dota2/images/heroes/antimage_vert.jpg', 'large': 'http://cdn.dota2.com/apps/dota2/images/heroes/antimage_lg.png'}, 2: ..... , 3: .... , 96: ....}
我还有一本字典
b = {'playername': 'Mind_Control', 'hero_id': 96, 'player_slot': 4, 'kills': 6, 'deaths': 2, 'assists': 4, 'level': 11}]
我想使用b['hero_id']
作为查找,从字典a获取vert
值hero_id
对应于字典a中的数字键
所以我试过了
{{a.{b.hero_id}.vert}
但什么也没发生。我不知道如何在django模板上搜索这个
{{a.96.vert}}
这给了我我想要的,但这是我手动键入它,这不会工作,因为我做了大量的数据
所以我需要上面的东西
目前没有回答
相关问题 更多 >
编程相关推荐