Re: [Tutor] Sorting a list in an add order

2006-09-06 Thread Alan Gauld
Matt, > However, I want to process them so that they are arranged in the > correct order, which means I need to sort the list of files. Of > course, because they aren't named in any (obvious) order, I'm a bit > stuck. > > I thought about using a dictionary to map names and order: so > {"OAF":1

Re: [Tutor] Sorting a list in an add order

2006-09-06 Thread Kent Johnson
Michael Janssen wrote: > you can specify your own comparing funtion for aList.sort(). Since Python 2.4, supplying a key function to list.sort() is generally preferable to a cmp function - the key function is easier to write and it is more efficient to use. See my reply to Matt for an example. K

Re: [Tutor] Sorting a list in an add order

2006-09-06 Thread Kent Johnson
Matt Williams wrote: > Dear List, > > I've written a small script to extract the definitions from my thesis, > and output them as a .tex file, which works ok but I have a small problem. > > The input is done by specifying a directory, and using glob to find the > ".tex" filenames. > > However, I

Re: [Tutor] Sorting a list in an add order

2006-09-06 Thread Michael Janssen
On 9/6/06, Matt Williams <[EMAIL PROTECTED]> wrote: > The input is done by specifying a directory, and using glob to find the > ".tex" filenames. > > However, I want to process them so that they are arranged in the correct > order, which means I need to sort the list of files. Of course, because >