What order does info get returned in by os.listdir()
Jeremy C B Nicoll
jernic at blueyonder.co.uk
Tue Aug 14 16:52:10 EDT 2007
What order does info get returned in by os.listdir() ?
I'm just starting to write python code, on an Win XP Pro machine. I've got
various directories which, when I look at them in Win XP, sorted by name, I
see in order, eg:
~prefixed file .txt
A.txt
B.txt
...
Z.txt
ie, XP seems to think that files with a "~" as their first character are
sorted ahead of A.
When I use os.listdir() to return that list of leaf values, I do seem to get
them in alphabetical order, A before B before C etc, but the ~-prefixed ones
are returned after the Z-prefixed files rather than before the A-ones.
I was wondering why...
--
Jeremy C B Nicoll - my opinions are my own.
More information about the Python-list
mailing list