I have this list of dictionaries which have a list as the value:
>>> lod
[{'A': ['100', '200', '300', 600]}, {'B': ['1000', '2000', '3000', 6000]}, {'C': ['1', '2', '3', 6]}]
and basically, I need to sort this list based on the last item in every dictionary's list.
So I used sorted() but it didn't work as expected:
>>> sorted(lod, key= lambda x: lod[0][''.join(list(lod[0].keys()))][3])
[{'A': ['100', '200', '300', 600]}, {'B': ['1000', '2000', '3000', 6000]}, {'C': ['1', '2', '3', 6]}]
What do you think is the problem here?
Thanks.
mapto convert your list items tointfirst