try to use key with sorted:
sorted(_list2,key=_list1.index)
for nested list you can use list comphresnion:
[sorted(x,key=_lis1.index) for x in _list2]
More Related Contents:
- Why does “return list.sort()” return None, not the list?
- How to sort a list/tuple of lists/tuples by the element at a given index?
- How to sort a list of objects based on an attribute of the objects?
- What is the difference between `sorted(list)` vs `list.sort()`?
- Pythonic way to check if a list is sorted or not
- How to sort two lists (which reference each other) in the exact same way
- Finding median of list in Python
- Combining two sorted lists in Python
- Why does ‘.sort()’ cause the list to be ‘None’ in Python? [duplicate]
- How to sort a list of tuples according to another list
- Custom Python list sorting
- case-insensitive list sorting, without lowercasing the result?
- Accessing the list while being sorted
- Does python have a sorted list?
- Python – How to sort a list of lists by the fourth element in each list? [duplicate]
- Efficient method to calculate the rank vector of a list in Python
- How do I sort a list of objects based on an attribute of the objects?
- Sorting list according to corresponding values from a parallel list [duplicate]
- Given parallel lists, how can I sort one while permuting (rearranging) the other in the same way?
- Sort a list with a custom order in Python
- How to sort multidimensional array by column?
- How to sort a 2D list? [closed]
- How to sort a list of strings in reverse order without using reverse=True parameter?
- Python Sort One List According to Another List
- Python: How to sort a list of dictionaries by several values?
- Split a list of tuples into sub-lists of the same tuple field [duplicate]
- Nested lambda statements when sorting lists
- How to find the max number(s) in a list with tied numbers
- How can I sort a list, according to where its elements appear in another list?
- Sort python list by function