擅长:python、mysql、java
<pre><code>from collections import Counter
fruits = ['apples','oranges','peaches','peaches','watermelon','oranges','watermelon']
counter = Counter(fruits)
sorted_fruits = sorted(counter.items(), key=lambda tpl: (-tpl[1], tpl[0]))
print(sorted_fruits[0][0])
</code></pre>
<p>输出:</p>
<pre><code>oranges
</code></pre>