I have a list which looks like this,
[('1', 'Michael'),
('2', 'Christopher'),
('3', 'Matthew'),
('4', 'Joshua'),
('5', 'Daniel'),
('6', 'David'),
('7', 'Andrew'),
('8', 'James'),
('9', 'Justin'),
('10', 'Joseph'),
('11', 'Ryan'),
('12', 'John'),
('13', 'Robert'),
('14', 'Nicholas'),]
Im trying to sort it using the second element,which is the names,im not exactly sure how to do this, This is what i have tried,but i cant get it to work,
sorted(mod , key = lambda x:mod[1])
sorted(mod, key = [x for x,v in enumerate(mod) mod[x][1]]
Any suggestions will be helpful,thanks in advance.