2010/4/22 Jo Chan <csj...@gmail.com>:
> Hi,friends.
>  I wanna ask if there is a function which is able to take a list as argument
> and then return its top-k maximums?
> I only know about max which is poorly a top-1 maximum function, now I want
> more yet I am lazy enough that don't want to write one by myself.

http://docs.python.org/library/heapq.html#heapq.nlargest

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to