xpath排除節點

不匹配含有指定子節點的節點

e.g:不匹配子節點含有 ‘i’ 節點的 ‘p’ 節點

response.xpath('//p[not(i)]')

不匹配含有指定屬性的節點

e.g:不匹配子節點含有 ‘class’ 屬性的 ‘p’ 節點

response.xpath('//p[not(@class)]')

排除指定節點

e.g:排除名為style的節點

response.xpath('/*[not(self::style)]')