Skip to content
Advertisement

Access the values of dictionaries in a list, then print them nicely

I have a list of dictionaries from which I need to extract information, and then print it out in a special format.

JavaScript

I need to access the values in these dictionaries and print them out in the following way:

JavaScript

If possible I would also need to print each key value at 20 characters max. Thus far I have tried for loops and list comprehensions but the farthest I’ve gotten is just printing out all the values in a one by one list.

Any help would be appreciated.

Advertisement

Answer

You just need to iterate over the list and do your printing for each item

JavaScript

Giving

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement