Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

rearrange list python

a_list = ["a", "b", "c"]
order = [1, 0, 2]

a_list = [a_list[i] for i in order]

print(a_list) #['b', 'a', 'c']
 
PREVIOUS NEXT
Tagged: #rearrange #list #python
ADD COMMENT
Topic
Name
5+7 =