Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort by last name using lambda

# Sort a variable called 'commander_names' by the last elements of each name.
sorted(commander_names, key=lambda x: x.split(" ")[-1])
Source by chrisalbon.com #
 
PREVIOUS NEXT
Tagged: #python #sort #lambda
ADD COMMENT
Topic
Name
3+8 =