Picking out items from a python list which have specific indexes

[main_list[x] for x in indexes]

This will return a list of the objects, using a list comprehension.


t = []
for i in indexes:
    t.append(main_list[i])
return t

map(lambda x:main_list[x],indexes)

If you're good with numpy:

import numpy as np
main_array = np.array(main_list) # converting to numpy array
out_array = main_array.take([2, 4, 5])
out_list = out_array.tolist() # if you want a list specifically