Help please :
myliste = ['Bullet train\t5018\n', 'Prey\t508\n', 'Treize vies\t1978\n', 'L’année du requin\t4398\n', 'Carter\t5004\n', 'Night Raiders\t1312\n', 'En décalage\t1789\n', 'The Bikeriders\t2134\n', 'Darling\t2008\n', 'Alina of Cuba\t678\n', 'Amants Super-héroïques\t837\n', 'Ménestrel\t3065\n', 'Des feux dans la nuit\t2144\n', 'Luck\t3148\n', 'Sita Ramam\t4498\n', 'Poikkal Kudhirai\t2248\n', 'Les Promesses d’Hasan\t3598\n', 'Wedding Season\t2490\n', 'Le Destin des Tortues Ninja, le Film\t845\n', 'La Vie en plus grand\t489\n', 'Hero Mode\t245\n', 'Embuscade\t1038\n', 'The Last Son\t1245\n', 'Mission Eagle\t998\n', 'Doblemente Embarazada\t745']
I want to sort this list according to the number, from the highest number to the lowest without changing the elements of my list, I have tried this :
def sort_films(LF):
a = i.index('\t')
b = i.index('\n')
c = i[a+2:b]
return(c)
LF.sort(key=sort_films,reverse=True)
the result I have is :
['Wedding Season\t2490\n', 'Treize vies\t1978\n', 'The Last Son\t1245\n', 'The Bikeriders\t2134\n', 'Sita Ramam\t4498\n', 'Prey\t508\n', 'Poikkal Kudhirai\t2248\n', 'Night Raiders\t1312\n', 'Ménestrel\t3065\n', 'Mission Eagle\t998\n', 'L’année du requin\t4398\n', 'Luck\t3148\n', 'Les Promesses d’Hasan\t3598\n', 'Le Destin des Tortues Ninja, le Film\t845\n', 'La Vie en plus grand\t489\n', 'Hero Mode\t245\n', 'En décalage\t1789\n', 'Embuscade\t1038\n', 'Doblemente Embarazada\t745', 'Des feux dans la nuit\t2144\n', 'Darling\t2008\n', 'Carter\t5004\n', 'Bullet train\t5018\n', 'Amants Super-héroïques\t837\n', 'Alina of Cuba\t678\n']
I don't know what to do please if you have a solution
print(sort_films(myliste[0]))to your program and see what it prints'Doblemente Embarazada\t745'has no"\n".