動態

詳情 返回 返回

xpath匹配一個標籤下所有內容 - 動態 詳情

from lxml import etree
import requests

url = 'http://www.shihuo.cn/youhui/474770.html#qk=youhui_list'
response = requests.get(url)
text = etree.HTML(response.text)

tt = text.xpath("//div[@class='article']")
info = tt[0].xpath("string(.)")

user avatar u_17494575 頭像 u_17353607 頭像 u_14540126 頭像 u_15505879 頭像 itwhat 頭像 xingchendahai_68d7dff410962 頭像 yejianfeixue 頭像 chiqingdezhentou 頭像 haoqidedalianmao 頭像 lintp 頭像 yanyingjie 頭像 gqkmiss 頭像
點贊 18 用戶, 點贊了這篇動態!
點贊

Add a new 評論

Some HTML is okay.