[Tutor] Simple counter to determine frequencies of words in a document

Emile van Sebille emile at fenx.com
Sun Nov 21 19:35:07 CET 2010


On 11/21/2010 8:15 AM Josep M. Fontana said...

>   return sorted(word_table.items(), key=lambda item: item[1], reverse=True)
<snip>
> What I don't understand is the syntax of "item : item[1]".

Key defines a lambda function that accepts as a single passed parameter 
named item and returns the element in position [1] thereof.

HTH,

Emile



More information about the Tutor mailing list