擅长:python、mysql、java
<p>不要使用字典,尝试迭代列表。在</p>
<pre><code>from itertools import cycle
li = [link1,link2]
running = True
licycle = cycle(li)
# fetch the next element
nextelem = licycle.next()
while running:
thiselem, nextelem = nextelem, licycle.next()
</code></pre>
<p>你可以参考这个-</p>
<p><a href="https://stackoverflow.com/questions/2167868/getting-next-element-while-cycling-through-a-list">Getting the next element while cycling through list </a></p>