Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort() with lambda

lst = ['id01', 'id10', 'id02', 'id12', 'id03', 'id13']
lst_sorted = sorted(lst, key=lambda x: int(x[2:]))
print(lst_sorted)
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #lambda
ADD COMMENT
Topic
Name
9+2 =