A possibility:
import os
_, _, file_names = os.walk("").next()
print sorted(file_names, key=lambda fn: os.stat(fn)[8])
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Khoa Nguyen a écrit :
> Hi,
>
> I have a requirement to process all files in a directory in
> chronological order.
Access time, modification time ? Ascending, descending ?-)
> The os.listdir() function, however, lists the
> files in random order. Is there a similar function in Python that
> allo
How about using os.listdir to build a list of filenames, then sorting
them by modification time (via os.stat)?
--
http://mail.python.org/mailman/listinfo/python-list
Khoa Nguyen wrote:
> I have a requirement to process all files in a directory in
> chronological order. The os.listdir() function, however, lists the
> files in random order. Is there a similar function in Python that
> allows me to specify the listing order (like ls -t for example)?
There is no s
Hi,
I have a requirement to process all files in a directory in
chronological order. The os.listdir() function, however, lists the
files in random order. Is there a similar function in Python that
allows me to specify the listing order (like ls -t for example)?
Thanks,
Khoa
--
http://mail.python