Case-Insensitive Sorting of Multi-Dimensional Lists
Ben Finney
bignose+hates-spam at benfinney.id.au
Fri Jun 8 18:36:43 EDT 2007
mosscliffe <mcl.office at googlemail.com> writes:
> I have tried the following, for a one dimensional list and it works,
> but I can not get my head around this lambda. How would this be
> written, without the lamda ?
>
> mylist = ['Fred','bill','PAUL','albert']
>
> mylist.sort(key=lambda el: el.lower())
Here's a hint:
>>> "FoO".lower()
'foo'
>>> str.lower("FoO")
'foo'
--
\ "When I was a baby I kept a diary. Recently I was re-reading |
`\ it, it said 'Day 1: Still tired from the move. Day 2: Everybody |
_o__) talks to me like I'm an idiot.'" -- Steven Wright |
Ben Finney
More information about the Python-list
mailing list