Nov-02-2021, 05:46 PM
Hi Lastile,
I think you are missing one important detail. You say you have 3 lists. And you want to keep the data together after sorting. This is very difficult.
Instead you should make one list. Each element of this list must also be a list (or tuple or dictionary ...). Each of these nested lists must contain the three elements filesize,modify and filename. So "yourlist[0][0]" would contain the filesize of the first file. And "yourlist[0][2]" the filename etc. Then you can use the
I think you are missing one important detail. You say you have 3 lists. And you want to keep the data together after sorting. This is very difficult.
Instead you should make one list. Each element of this list must also be a list (or tuple or dictionary ...). Each of these nested lists must contain the three elements filesize,modify and filename. So "yourlist[0][0]" would contain the filesize of the first file. And "yourlist[0][2]" the filename etc. Then you can use the
sort()
or sorted()
function with the key=
argument as Gribouillis suggested.