Find file in directory with the highest number in the filename
问题 My question is closely related to Python identify file with largest number as part of filename I want to append files to a certain directory. The name of the files are: file1, file2......file^n. This works if i do it in one go, but when i want to add files again, and want to find the last file added (in this case the file with the highest number), it recognises 'file6' to be higher than 'file100'. How can i solve this. import glob import os latest_file = max(sorted(list_of_files, key=os.path