In win32 and linux platform, os modules has diffreent output order, is it a bug?
nobody at nowhere.com
Fri Mar 1 13:56:50 CET 2013
On Fri, 01 Mar 2013 17:24:05 +0800, Honghe Wu wrote:
> Thanks! Cause I need sorted returnd list, and the arbitrary list makes the
> other procedure go wrong. Maybe the I/O speed is more important in other
You can sort the lists of files and subdirectories with e.g.:
for root, dirs, files in os.walk(os.getcwd()):
dirs[:] = sorted(dirs)
files = sorted(files)
Note that modifying the directory list in-place will affect which
subdirectories are traversed and in what order.
More information about the Python-list