How can I make this code not print an entire list and just a single name and time
<pre><code>from lxml import html
import requests

page = requests.get('http://www.runningzone.com/wp-content/uploads/2016/09/Turtle-Krawl-Overall-Results-2016.html')
tree = html.fromstring(page.content)

x=2
while True:
    xpathName = "/html/body/div[2]/table/tbody/tr['x']/td[4]//text()"
    xpathTime = "/html/body/div[2]/table/tbody/tr['x']/td[9]//text()"
    name = tree.xpath(xpathName)
    time = tree.xpath(xpathTime)
    print (name), (time)
    x += 1
</code></pre>

<p>So I'm trying to make this print both the person name and time using the xpath.  For some reason the code prints out an entire list of both the name and time, even though I'm pretty sure the xpath of the Name and Time should print a single name.  If I replace the 'x' part with just a single number, it prints just one name.  But if I tell the code to print 'x' where it replacesx with a different number each loop, it just prints huge lists.</p>

<p><code>'x'</code> does not interpolate the <code>x</code> variable into the string.  You need to do something like this:</p>

<pre><code>xpathName = "/html/body/div[2]/table/tbody/tr[%d]/td[4]//text()" % (x,)
xpathTime = "/html/body/div[2]/table/tbody/tr[%d]/td[9]//text()" % (x,)
</code></pre>

<p>Also, as @grael mentioned, you need to terminate your loop somewhere.</p>

python