0
How to print a key of dictionary with all values?
m = {"human":{"man":2 "women":3},animal:{ "cat":4, "zebra":5}} >>> how print data like this: human: man 2 woman 3 animal: cat 4 zebra 5
3 RĂ©ponses
+ 3
In Python 3.x you can do the following:
m = {"human":{"man":2, "women":3},"animal":{ "cat":4, "zebra":5}}
for key, value in m.items():
print(key + ":")
for innerKey, innerValue in value.items():
print(innerKey + " " + str(innerValue))
+ 1
but output is more than I want, this code repeated keys and values
0
thank u, thats worked