Simple sort for lists?
Alex Martelli
aleax at aleax.it
Thu Nov 21 06:32:36 EST 2002
More information about the Python-list mailing list
Thu Nov 21 06:32:36 EST 2002
- Previous message (by thread): Simple sort for lists?
- Next message (by thread): string encoding problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
R. Arens wrote: > Hi, I'm using os.path.walk to walk through directories and join > ordered files in the directories into one large file. Problem is, > os.path.walk doesn't process the files in order, due to the way > os.path.walk sends the filenames to the visit function. Does Python > provide a method to sort the list of filenames provided by > os.path.walk? You can easily sort a list, in any way you have obtained it, by calling the sort method of the list -- it gets sorted in-place. So, if x is bound to a list object, that list object will be sorted after you've called x.sort(). Alx
- Previous message (by thread): Simple sort for lists?
- Next message (by thread): string encoding problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list