0
dictionary within dictionary
Hi guys. I will be direct. How can I access keys or items within another key, that is, it is a dictionary within a dictionary. I will leave an example code. From now on, I am very grateful to anyone who can help me. compras = { 'frutas_joao': { 'pera': 50, 'uva': 2, 'maçã':55, 'abacaxi': 25, }, 'frutas_maria': { 'pera': 40, 'uva': 3, 'maçã':35, 'abacaxi': 15, },}
1 Antwort
+ 5
print(compras["frutas_joao"]["pera"])
output:
50