python爬虫-使用xpath方法

#coding=utf-8
import re
from lxml import etree

import requests

response = requests.get("http://yeves.cn/")
content = response.content.decode()

html = etree.HTML(content)
res = html.xpath('/html/body/section/aside/div[1]/div/h3/text()')
print(res)

  

posted @ 2018-04-23 15:15  brady-wang  阅读(309)  评论(0编辑  收藏  举报