I have a python list of lists like this
[['CCND1', '67', 'FAS', '99', 'IRAK3', '92', 'ALG14', '86', 'ADRBK1', '10'], ['PTRX', '95', 'CCNA', '33']]
Each alphabetical value is associated with the numeric value , i.e IRAK3
and 92
are associated (92
, should appear after IRAK3
) and PTRX
and 95
are associated (95
should appear after PTRX
). Now , I want to alphabetically sort this list of lists so that the sorted list looks like this:
[['ADRBK1', '10', 'ALG14', '86', 'CCND1', '67', 'FAS', '99', 'IRAK3', '92' ], ['CCNA', '33', 'PTRX', '95' ]]
Note that in the sorted list, the alphabetical values are sorted but again, note that 92
, appear after IRAK3
AND 95
appear after PTRX
i.e the association is maintained.
How could I do that ?