Am I able to define my own sort order and still use the Python sort function? For example, say my desired sorting order is:
list1 = ['Stella', 'Bob', 'Joe', 'Betty']
I'd hoped to do something like:
list2 = ['Joe', 'Stella']
sorted(list2, key=list1)
and get:
['Stella', 'Joe']
where the sorted order stays within the custom order in list1. I can do it in multiple steps by swapping out for numeric values but thought there may be a way to do it similar to above.