Reputation: 175
I am converting lists to dictionary...the dictionary may contain duplicate key value pairs. Python Dictionary returns key value pairs based on the last occurrence in the input data. How can i take first key-value pairs from the dictionary when a key repeats multiple times?
i see one solution as mentioned in following link, i need to create list of values for key and then take first element from the values list. List of values for duplicate keys in dictionary Python
Is there any other better way to do this?
Upvotes: 1
Views: 729