擅长:python、mysql、java
<p>可能是这样:</p>
<pre><code>xs = [(0, 34), (1, 77), (2, 6), (3, 60), (4, 2), (5, 5), (6, 13)]
secs = sorted(set(x[1] for x in xs))
res = [(x[0], secs.index(x[1])) for x in xs]
print res # [(0, 4), (1, 6), (2, 2), (3, 5), (4, 0), (5, 1), (6, 3)]
</code></pre>
<p>或者是一个单一的理解(但是有二次方的表现):</p>
^{pr2}$