I have this nested list and want to sort list base on tuple key and value respectively.
data = [ 14, [('the', 3),
('governing', 1),
('wisdom', 1),
('about', 3),
('writing', 1)]]
And output is
output = [ 14, [('about', 3),
('governing', 1),
('wisdom', 1),
('writing', 1),
('the', 3)]]
sort something like this
[data_structure[0],sorted(data_structure[1],key = lambda x: x[1])]
yet without this slice sort and merge approach, if there is better way , please share. Looking for your clean pythonic approach.
definitely grateful for a python newbie like me.