> If you want a good answer you have to give me/us more details, and an > example too.
OK, here is some example data: reaction is BUT by the sodium , BUT it is sea , BUT it is this manner BUT the dissolved pattern , BUT it is rapid , BUT it is As each line consists of 5 words, I would break up the data into an array of five-field-arrays (Would you use lists or tuples or a combination in Python?). The word "BUT" would be in the middle, with two fields/words left and two fields/words right of it. I then want to sort this list by - field 3 - field 4 - field 1 - field 0 in this hierarchy. This is the desired result: pattern , BUT it is rapid , BUT it is sea , BUT it is sodium , BUT it is reaction is BUT by the this manner BUT the dissolved The first 4 lines all could not be sorted by fields 3 & 4, as they are identical ("it", "is"), so they have been sorted first by field 1 (which is also identical: ",") and then by field 0: pattern rapid sea sodium I hope I have explained this in an understandable way. It would be cool if you could show me how this can be done in Python! Regards, Rehceb -- http://mail.python.org/mailman/listinfo/python-list