Ok. That's the point. I think i meant case-sensitive. There are
some ways described here that will me help out.
Yes, the list is sorted when i print it out.
It was my fault, sorry guys.
Thank you a lot.
mac
___
Tutor maillist - Tutor@python.org
http:/
> In python2.4, you can also use the key= keyword argument:
>
> ###
> def toUpper(s):
> return s.upper()
> files.sort(key=toUpper)
> ###
>
> This is more efficient, I believe, because the key function is only
> called once for each element, whereas cmp is called more than once.
>
> (we could use
On 24/11/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
> The files that start with uppercase come first because of the way those
> strings compare to lowercase strings. If we want a case-insensitive sort,
> we can do something like this:
>
> ##
> >>> def case_insensitive_cmp(a, b):
> ... return
At 09:55 AM 11/23/2005, lmac wrote:
>i have a list with the dirs/files from the current path. When i use
>sort() to sort the list alphabetically the list is still unsorted.
When you say "unsorted" - are the list members in the same order as
before the sort?
>dirs_files = os.listdir(os.getcwd())
On Wed, 23 Nov 2005, lmac wrote:
> i have a list with the dirs/files from the current path. When i use
> sort() to sort the list alphabetically the list is still unsorted. How
> to use ?
>
> dirs_files = os.listdir(os.getcwd())
> print dirs_files
> dirs_files.sort()
> print dirs_files
Hi lmac,
Hallo,
i have a list with the dirs/files from the current path.
When i use sort() to sort the list alphabetically the list
is still unsorted. How to use ?
dirs_files = os.listdir(os.getcwd())
print dirs_files
dirs_files.sort()
print dirs_files
Thank you.
_