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 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, 
"Valuation":2...etc}, but I don't don't know how to take it on from 
here. I was thinking of looking up the filename in the dictionary (using 
.startswith() to get some basic rough-matching capacity) and then using 
that to return the order that the files should be handled in.

Any comments/ better ideas?

Thanks,

Matt
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to