What order does info get returned in by os.listdir()
Zentrader
zentraders at gmail.com
Tue Aug 14 18:41:35 EDT 2007
On Aug 14, 1:52 pm, Jeremy C B Nicoll <jer... at blueyonder.co.uk> wrote:
> 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