Cool! Thanks a lot! That's exactly what I want. <div><br></div><div>Best regards,</div><div><br></div><div>Songjian<br><br><div class="gmail_quote">On Thu, Apr 22, 2010 at 10:04 PM, Chris Rebert <span dir="ltr"><<a href="mailto:crebert@ucsd.edu">crebert@ucsd.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2010/4/22 Jo Chan <<a href="mailto:csjcg2@gmail.com">csjcg2@gmail.com</a>>:<br>
<div class="im">> Hi,friends.<br>
> I wanna ask if there is a function which is able to take a list as argument<br>
> and then return its top-k maximums?<br>
> I only know about max which is poorly a top-1 maximum function, now I want<br>
> more yet I am lazy enough that don't want to write one by myself.<br>
<br>
</div><a href="http://docs.python.org/library/heapq.html#heapq.nlargest" target="_blank">http://docs.python.org/library/heapq.html#heapq.nlargest</a><br>
<br>
Cheers,<br>
Chris<br>
<font color="#888888">--<br>
<a href="http://blog.rebertia.com" target="_blank">http://blog.rebertia.com</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>------------------<br>Best Regards<br><br>陈松坚<br>信息科学与技术学院 中山大学 广州大学城 510006<br>Chen Songjian<br>School of Information Science & Technology<br>Sun Yat-sen(Zhongshan) University, Guangzhou Higher Education Mega Center, China, 510006<br>
Mobile: +86-137-6069-6137 <br>Email: <a href="mailto:csjcg2@gmail.com">csjcg2@gmail.com</a><br>
</div>