how to sort a 2d list in python according to single dimension list code example Example: sorting by second element sorted(LISTNAME, key=lambda x: x[1])