Answer the question
In order to leave comments, you need to log in
How to sort the list in the right order?
You want the values to start in the specified order, and not the specified values to be sorted as usual.
lst = ['asd', 'aaa', 'str1', 'str2', 'str3']
order = ['str1', 'str3']
result = ['str1', 'str3', 'aaa', 'asd', 'str2']
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question