operator.itemgetter: Get Multiple Items From a List or Dictionary

operator.itemgetter: Get Multiple Items From a List or Dictionary

Normally, to access multiple indices from a list, you need to use list comprehension. To do the same thing with simpler syntax, use operator.itemgetter instead.

Link to other tips on Python’s built-in libraries.

Search

Related Posts

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran