Skip to content
Advertisement

How can I retrieve a list of values in an array that has same name but different version? [closed]

For example if I have a list:

JavaScript

if I have to retrieve just the nameoffile1 based on names how can I retrieve those 2 arrays based on names

thanks

Advertisement

Answer

You can use a dictionary to collect together all the items with the same name. If you use defaultdict to create an empty list the first time a name is encountered, it becomes trivial.

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