why the conut( ) can not get the number?

水静流深 1248283536 at qq.com
Sat Dec 8 19:33:06 EST 2012


i wnat to get the number of  a atrributes in a xpath,here is my code,why i can not get the number ? 
import urllib
import lxml.html
down="http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html" 
file=urllib.urlopen(down).read() 
root=lxml.html.document_fromstring(file)
for order,node in enumerate(root.xpath('//li[@class="toctree-l1"]')):
  print order,node.xpath('.//a[count(*)]')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121209/abe432f3/attachment.html>


More information about the Python-list mailing list