Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

operator.itemgetter(1) in python

sorted(movies, key=itemgetter('date'))#equivalent to "sorted(movies, key = lambda x: x['date'])"Output: [{'name': 'Avengers: Age of Ultron', 'date': '24/4/2013'}, {'name': 'Iron Man 3', 'date': '26/4/2013'}, {'name': 'Avengers Endgame', 'date': '26/4/2019'}]
Source by siddharth1.medium.com #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
5+6 =