import operator m=["Tallinn", "Tartu", "Narva"] x=[0, 2] print(operator.itemgetter(*x)(m))