[Tutor] getting the last file in a folder (reliably)

Peter Otten __peter__ at web.de
Wed Mar 23 07:48:35 CET 2011


Steven D'Aprano wrote:

> files.sort()
> the_file_name = files[-1]

You don't need to sort if you want only one file:

the_file_name = max(files)




More information about the Tutor mailing list