Python: Listen nach Indizes filtern
In Python habe ich eine Liste von ElementenaList
und eine Liste von IndizesmyIndices
. Gibt es eine Möglichkeit, diese Artikel auf einmal abzurufen?aList
mit als Indizes die Werte inmyIndices
?
Beispiel:
>>> aList = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
>>> myIndices = [0, 3, 4]
>>> aList.A_FUNCTION(myIndices)
['a', 'd', 'e']