I have a list like this:
[('TIPE_ORG', 'Corea'), ('TIPE_ORG', 'United Kingdom'), ('TIPE_ORG', 'Russia'), ('TIPE_ORG', 'Germany'),('TIPE_PER', 'Pepe Martínez')]
I want it to be sorted by text length from largest to smallest of the second parameter Let it be like this:
[('TIPE_ORG', 'United Kingdom'),('TIPE_PER', 'Pepe Martínez'), ('TIPE_ORG', 'Germany'), ('TIPE_ORG', 'Russia'),('TIPE_ORG', 'Corea')]
I have tried to do this, but having two parameters does not order it for the second, but for the first TIPE_ORG:
x.sort(key=len, reverse=True)