Answers for "how to set order By in list"

4

orderd set in python

pip install ordered-set
from ordered_set import OrderedSet
letters = OrderedSet('abracadabra')
print(letters) # {'a', 'b', 'r', 'c', 'd'}
Posted by: Guest on July-22-2020
0

reorder list python

a_list = ["a", "b", "c"]
order = [1, 0, 2]
a_list = [a_list[i] for i in order]
Posted by: Guest on September-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language