I have the following list created from a sorted csv
list1 = sorted(csv1, key=operator.itemgetter(1))
I would actually like to sort the list
employees.sort(key = lambda x:x[1])
employees.sort(key = lambda x:x[0])
We can also use .sort with lambda 2 times because python sort is in place and stable. This will first sort the list according to the second element, x[1]. Then, it will sort the first element, x[0] (highest priority).
employees[0] = Employee's Name
employees[1] = Employee's Salary
This is equivalent to doing the following: employees.sort(key = lambda x:(x[0], x[1]))