# 10 examples of 'sort 2d list python' in Python

Every line of 'sort 2d list python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

## All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
``70def sorted(lst, cmp=None, key=None, reverse=None):71    "sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list"72    sorted_lst = list(lst)73    sorted_lst.sort(cmp, key, reverse)74    return sorted_lst``
``455def Sort(self):456    r"""Sort(doubleArray self)"""457    return _array.doubleArray_Sort(self)``
``909""" Contains(self: Queue[T], item: T) -> bool """910pass``
``22def Quick_Sort(list):23    Quick(list, 0, len(list) - 1)``
``13def selectionSort2(list):14    for index in range(0,len(list)-1):15        indexMin = 016        for i in range(index+1,len(list)):17            if list[i] < list[indexMin]: indexMin = i18        if indexMin > index:19            temp           = list[index]20            list[index]    = list[indexMin]21            list[indexMin] = temp``
``134def ilist(d,l,x,y,z):135	global threshold136	137	v=d.get_value_at(x,y,z)138	if v>threshold : insort(l,(v,x,y,z))``
``27def quick_sort(myList, start, end):28    if start < end:29        # partitioning the list30        split = partition(myList, start, end)31        # split halves & sort both halves32        quick_sort(myList, start, split - 1)33        quick_sort(myList, split + 1, end)34    return myList``
``356def test_11_sorting(self):357    'Sorting'358    pl, ul = self.lists_of_len()359    pl.insert(0, pl.pop())360    ul.insert(0, ul.pop())361    pl.sort()362    ul.sort()363    self.assertEqual(pl[:], ul[:], 'sort')364    mid = pl[len(pl) // 2]365    pl.sort(key=lambda x: (mid - x) ** 2)366    ul.sort(key=lambda x: (mid - x) ** 2)367    self.assertEqual(pl[:], ul[:], 'sort w/ key')368369    pl.insert(0, pl.pop())370    ul.insert(0, ul.pop())371    pl.sort(reverse=True)372    ul.sort(reverse=True)373    self.assertEqual(pl[:], ul[:], 'sort w/ reverse')374    mid = pl[len(pl) // 2]375    pl.sort(key=lambda x: (mid - x) ** 2)376    ul.sort(key=lambda x: (mid - x) ** 2)377    self.assertEqual(pl[:], ul[:], 'sort w/ key')``
``16def insertionSort2(list):17    for index in range(0,len(list)-1):18        value = list[index]19        i = index20        while(i > 0 and list[i-1] > value):21            list[i] = list[i-1]22            i = i - 123        list[i] = value``
``10def unordered_list_cmp(list1, list2):11    # Check lengths first for slight improvement in performance12    return len(list1) == len(list2) and sorted(list1) == sorted(list2)``