import lxml.html<br> myxml='''<br> <cooperate><br> <job DecreaseHour="1" table="tpa_radio_sum"> <br> </job><br><br> <job DecreaseHour="2" table="tpa_radio_sum"> <br>
</job><br><br><br> <job DecreaseHour="3" table="tpa_radio_sum"><br> </job><br> </cooperate><br> '''<br> root=lxml.html.fromstring(myxml)<br>
nodes1=root.xpath('//job[@DecreaseHour="1"]')<br> nodes2=root.xpath('//job[@ne_type="101"]')<br> print "nodes1=",nodes1<br> print "nodes2=",nodes2<br><br>
what i get is: <br>nodes1=[] and <br>nodes2=[<Element job at 0x13636f0>] <br>why nodes1 is []?nodes2=[<Element job at 0x13636f0>], <br>it is so strange thing?why ?<br>