Vote count: 0
I am trying to print multiple dictionaries on separate lines, that contain the same keys, but different values each time. The values can be different in a way that each time the dictionary is printed, it can appear messy; because the keys are in different places every time. For example:
{0: 10, 1: 5, 2: 2, 3: 4, 4: 1, 5: 1, 6: 0, 7: 0, 8: 0, 9: 0, 10: 1}
{0: 309, 1: 156, 2: 76, 3: 36, 4: 22, 5: 6, 6: 4, 7: 5, 8: 1, 9: 0, 10: 1}
{0: 478, 1: 216, 2: 125, 3: 57, 4: 37, 5: 9, 6: 2, 7: 2, 8: 2, 9: 0, 10: 1}
{0: 1287, 1: 717, 2: 332, 3: 165, 4: 94, 5: 26, 6: 15, 7: 9, 8: 8, 9: 4, 10: 1}
{0: 104, 1: 53, 2: 24, 3: 17, 4: 6, 5: 4, 6: 0, 7: 1, 8: 0, 9: 1, 10: 1}
How can I print dictionaries in a way that the keys will be on the same column, each time the dictionary is printed so that? This way, the dictionary will be of equal length every time, and appear neater as a result.
asked 40 secs ago
How to print a dictionary with keys on identical columns each time?
Aucun commentaire:
Enregistrer un commentaire