In this example we will show how to sort list rows based on the second element in the sublist with Python.
Source Code
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
a=[["a", 25],["C", 32],["G", 12],["g", 18]]
a.sort(key=lambda x:(x[1],x[0]))
print(a)
Output:
[['G', 12], ['g', 18], ['a', 25], ['C', 32]]