list comprehension python get index code example Example: python list comprehension index, value list2 = [x for ind, x in enumerate(list1) if 4 > ind > 0]