[Tutor] question on lists

Martin Klaffenboeck martin.klaffenboeck@gmx.at
08 Sep 2002 13:27:09 +0200


Am Sa, 2002-09-07 um 23.33 schrieb Sean 'Shaleh' Perry:

> 
> list.sort() takes a function to determine sort order.  There is a handy 
> function called cmp() which is often used for this.
> 
> Your add function is not too hard to write and the random module may give you 
> what you want for the random stuff.

Ok, that works good with 

for x in words:
	if x[0] < newword:
		continue
	if x[0] > newword:
		break

	pos = words.index(x)

But what can I do that the words are sorted case insensitive. (No matter
about upper and lower case letters)?
 
And how can I tell words.sort() that it should only sort the first
column of my 4 column list?

Martin

--