You can do it like this
mylist = ['a', 'b', 'c', 'd', 'e']
myorder = [3, 2, 0, 1, 4]
mylist = [mylist[i] for i in myorder]
print(mylist) # prints: ['d', 'c', 'a', 'b', 'e']
More Related Contents:
- Sorting arrays in NumPy by column
- Sort multidimensional array based on 2nd element of the subarray
- Find elements of array one nearest to elements of array two
- Sort invariant for numpy.argsort with multiple dimensions
- Efficiently sorting a numpy array in descending order?
- How to sort multidimensional array by column?
- Sorting a python array/recarray by column
- argsort for a multidimensional ndarray
- Finding Nth item of unsorted list without sorting the list
- I have a list of file names and I need to be able to count how many of the same file gets repeated for each file name [closed]
- Python/NumPy first occurrence of subarray
- How do I count occurrence of unique values inside a list
- Replacing Numpy elements if condition is met
- How to make a multidimension numpy array with a varying row size?
- PIL: Convert Bytearray to Image
- Sorting Python list based on the length of the string
- subsampling every nth entry in a numpy array
- What does [:] mean?
- Binary random array with a specific proportion of ones?
- How does python compare functions?
- Sorting by absolute value without changing to absolute value
- Add multiple values to one numpy array index
- Flattening a list of NumPy arrays?
- Fastest pairwise distance metric in python
- What algorithm does Python’s built-in sort() method use?
- Python: Elegant and efficient ways to mask a list
- Efficient dot products of large memory-mapped arrays
- sorting list of nested dictionaries in python
- Rearranging list based on order of another list
- SWIG/python array inside structure