- Original Message -
> I am having issues with the urllib and lxml.html modules.
> Here is my original code: import urllib import lxml . html
> down = 'http://v.163.com/special/visualizingdata/' file = urllib .
> urlopen ( down ). read () root = lxml . html . document_fromstring (
> file
Hi anonymous,
your code is working perfectly right. It's just that the only time that
you find anything matching //div[@class="col f-cb"] is this one:
名称
视频下载
课程简介
And obviously, there's no in there, so the xpath won't match.
Cheers,
Philipp
On 02/22/2013 02:24 AM, python wrote
I am having issues with the urllib and lxml.html modules.
Here is my original code:
import urllib
import lxml.html
down='http://v.163.com/special/visualizingdata/'
file=urllib.urlopen(down).read()
root=lxml.html.document_fromstring(file)
xpath_str="//div[@class='down s-fc3 f-fl']/a"
url