Hello All,

While trying to inderstand Kent's script [1] I struggle on the use of
operator.itemgetter(1) from the following piece of code. I understand
it makes it sort on the second value of the counts.iteritems but I do
not understand how  operator.itemgetter(1) works.

for name, count in
sorted(counts.iteritems(),key=operator.itemgetter(1), reverse=True):

Could someone help me understand this?

Thanks
Sander

[1] http://mail.python.org/pipermail/tutor/2009-January/065986.html
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to