What order does info get returned in by os.listdir()

Miles semanticist at gmail.com
Wed Aug 15 10:35:16 EDT 2007


On 8/15/07, Jeremy C B Nicoll wrote:
> Marc 'BlackJack' Rintsch wrote:
> > > How would I sort leaflist in a way that mimics the sort order that XP
> > > shows me things under?
> >
> > This depends on what XP is.  Which program?  Which locale?  How does the
> > locale influence that programs sorting?
>
> Well... XP is Windows XP (Pro as I think I said earlier), and I'm in the UK.
> I explained earlier how XP shows me stuff in order when I tell it to sort by
> name.

Case insensitive sort with ~ coming before all other characters:
some_list.sort(key=lambda k: k.lower().split("~"))



More information about the Python-list mailing list