hi guys n girls
im making a list of the biggest files on my computer i have got most of the coding done but i have hit a brick wall with the sort function.
i can sort the size or the file name but as they are both in the same list i cannot sort by size as they have got rid of this function in python 3.1 if anyone can help me with this it would be great!
\/ example of list \/
size F.name
[256, '.\\abc.py']
[366, '.\\test123.py']
[286, '.\\testab.py']
[0, '.\\dir1\\Copy (10) of New Text Document (2).txt']
[0, '.\\dir1\\Copy (10) of New Text Document.txt']
[82, '.\\dir1\\Copy (10) of tessdfsdt5.txt']
\/ code to get the list \/
import os
folder = ('.')
fsize=list()
filename=list()
filesize=list()
for (path, dirs, files) in os.walk(folder):
for dirs in path:
for file in files:
filename = os.path.join(path, file)
file_size = os.path.getsize(filename)
fsize= file_size, filename
Fsize=list(fsize)
#Fsize.sort()--->>> TypeError: unorderable types: str() < int()
print(Fsize)
break