为什么它没有进入 "for loop"

why it is not entering to "for loop"

page = requests.get('http://anywebsite/anysearch/') 
tree = html.fromstring(page.content)

lists =  tree.xpath('.//div[@class="normal-view"]')
print "lists"
for i in lists:
    print "1"
    title = i.xpath('.//div[@class="post-entry"/h1//a/@href]//text()')
    print title,"2"
print "3"

我已经给出了 print("list","1","2","3") 语句来检查程序是否进入循环。

我得到的输出是

lists
3
[Finished in 0.3s]

以下 Python 2 代码使用您提供的 URL 成功打印了正在审查的电影的标题。

from lxml import etree
parser = etree.HTMLParser()
tree = etree.parse("http://boxofficeindia.co.in/review-mirzya/", parser)
title = tree.xpath("string(//h1)")
print title

执行此操作会得到:

> python ~/test.py
Review: Mirzya

如果这不是您想要的,请在您的问题中更具体。