I have a list in python that looks like below
a=[['David','McConor','123000','900']
['Timothy','Gerrard','123001','901']]
I desire to sort the list above using the last entry of each sublist as the key. I have succesfully sorted the list lexicographically using the a.sort()
function. Now i want to sort the list and print each sublist such that the list with '901' comes first is my problem.
What I tried
##defining what mykey is where am stuck
mykey=
##the sort function has overloads for key
a.sort(key=mykey,reverse=True)
Thanks for your contribution.