code1:<br>import lxml.html<br>import urllib<br>down='http://finance.yahoo.com/q/op?s=C+Options'<br>content=urllib.urlopen(down).read()<br>root=lxml.html.document_fromstring(content)<br>table = root.xpath("//table[@class='yfnc_mod_table_title1']")[0]<br>tds=table.xpath("tr[@valign='top']//td")<br>for  td  in tds:<br>    print  td.text_content()<br><br>what i get is :<br>Call Options<br>Expire at close Friday, September 16, 2011<br>these are waht i want.<br><br>code2<br>import lxml.html<br>
import urllib<br>
down='http://finance.yahoo.com/q/op?s=C+Options'<br>
content=urllib.urlopen(down).read()<br>
root=lxml.html.document_fromstring(content)<br>
table = root.xpath("//table[@class='yfnc_mod_table_title1']")[0]<br>
tds=table.xpath("//tr[@valign='top']//td")<br>
for  td  in tds:<br>
    print  td.text_content()<br><br>what i get is :<br>N/A<br>N/A<br>2<br>114<br>48.00<br>C110917P00048000<br>16.75<br> 0.00<br>N/A<br>N/A<br>0<br>23<br>50.00<br>C110917P00050000<br>23.16<br> 0.00<br>N/A<br>N/A<br>115<br>2,411<br>   <br>   <br>   <br>Highlighted options are in-the-money.<br>(omit  something)<br>there is only one difference between   code1 and code2  :<br>in code1 is :   tds=table.xpath("tr[@valign='top']//td")<br>in code2 is:   tds=table.xpath("//tr[@valign='top']//td")<br><br>i want to know  why  the  "//"  make output  different?<br>