from lxml import etree
doubanhtml = ''''''
doc = etree.fromstring(doubanhtml)
for eachbook in doc.xpath('//dl/dd'):
bookname = eachbook.xpath('a/text()')[0]
bookurl = eachbook.xpath('a/@href')[0]
pub = eachbook.xpath('div[@class="desc"]/text()')[0]
rate = eachbook.xpath('div[@class="rating"]/span[@class="rating_nums"]/text()')[0]
print bookname,bookurl,pub,rate