Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort by last name using lambda

students = ["Merol B Joseph", "Ferzil Babu", "Basil Abraham", "Kiran Baby", "Ziya sofia"]
x = sorted(students, key=lambda name: name.split(" ")[-1].lower())
print x
print students
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #sort #lambda
ADD COMMENT
Topic
Name
5+3 =