for root, dirs, files in
os.walk(r'\\cusfs01\userprof$\khalha\Desktop\AllSalesForecasting'):
for name in files:
sorted(files, key=lambda)
print(files)
I have found many examples of sorting with physical lists, but since my list of files is just in this directory, I do not know how to sort it correctly. I have 54 files and it is doing that thing where 9 appears to be the latest file where I want 54 to appear as the last. it may seem like a duplicate question but I don't know how to fix this issue and the other questions similiar do not address this. My files are all named number starting from 0 to 54. They are csv filesm so the files are 0.csv,1.csv,...54.csv. When i print the files, or try to get the last file name, it shows it as 9.csv. I want them to be listed numerically