I have a dictionary defined like this:
movements = {
"KYOGRE": {
1: {
"name": "HYDRO PUMP",
"type": "WATER",
"pp": 5,
"category": "special",
"power": 110,
"accuracy": 80,
"secundary_effect": "",
"possibility": ""
},
2: {
"name": "SURF",
"type": "WATER",
"pp": 15,
"category": "special",
"power": 90,
"accuracy": 100,
"secundary_effect": "",
"possibility": ""
},
3: {
"name": "WATERFALL",
"type": "WATER",
"pp": 15,
"category": "physic",
"power": "80",
"accuracy": "100",
"secundary_effect": "FLINCH",
"possibility": 20
},
4: {
"name": "THUNDER",
"type": "ELECTRIC",
"pp": 10,
"category": "special",
"power": "110",
"accuracy": "70",
"secundary_effect": "PARALYZE",
"possibility": 30
}
}
}
return movements[str(pokemon).upper()].values()
when sending kyogre it hurts me a list with this structure:
[dict_values([
{'name': 'HYDRO PUMP', 'type': 'WATER', 'pp': 5, 'category': 'special', 'power': 110, 'accuracy': 80, 'secundary_effect': '', 'possibility': ''},
{'name': 'SURF', 'type': 'WATER', 'pp': 15, 'category': 'special', 'power': 90, 'accuracy': 100, 'secundary_effect': '', 'possibility': ''},
{'name': 'WATERFALL', 'type': 'WATER', 'pp': 15, 'category': 'physic', 'power': '80', 'accuracy': '100', 'secundary_effect': 'FLINCH', 'possibility': 20},
{'name': 'THUNDER', 'type': 'ELECTRIC', 'pp': 10, 'category': 'special', 'power': '110', 'accuracy': '70', 'secundary_effect': 'PARALYZE', 'possibility': 30}])
]
printing them like this:
def run(self):
for attacks in range(len(self.pokemon_movements)):
print(self.pokemon_movements[attacks].name)
the output should be:
hydro pump
surf
dive
thunder
gives me the error:'dict_values' object has no attribute 'name'