[python] Python - How to sort a list of lists by the fourth element in each list?

I would like to sort the following list of lists by the fourth element (the integer) in each individual list.

unsorted_list = [['a','b','c','5','d'],['e','f','g','3','h'],['i','j','k','4','m']]

How can I do this? Thank you!

This question is related to python list sorting

The answer is


unsorted_list.sort(key=lambda x: x[3])

Similar questions with python tag:

Similar questions with list tag:

Similar questions with sorting tag: