擅长:python、mysql、java
<p>使用格式字符串。在</p>
<p>并使用<code>range()</code>(或<code>xrange()</code>表示更大的数字)。它正是你想要的。在</p>
<pre><code>for x in range(10):
driver.find_element_by_xpath("/html/body/div[7]/div/div/div[2]/div[%d]/div[2]/div[1]/div/button" % (x,)).click()
</code></pre>