I am a python newbie trying to achieve the following:
I have a list of lists:
lst = [[567,345,234],[253,465,756, 2345],[333,777,111, 555]]
I want map lst into another list containing only the second smallest number from each sublist. So the result should be:
[345, 465, 333]
For example if I were just interested in the smallest number, I could do:
map(lambda x: min(x),lst)
I wish I could do this:
map(lambda x: sort(x)[1],lst)
but sort does not chain. (returns None)
neither is something like this allowed:
map(lambda x: sort(x); x[1],lst) #hence the multiple statement question
Is there a way to do this with map in python but without defining a named function? (it is easy with anonymous blocks in ruby, for example)