1、使用xpath获取文本内容,有空格或者换行就用normalize-space()方法例:
2、或者:normalize-space()例子:原来的xpath为:user=selector.xpath('//*[@id="Con"]/tr[1]/th/text()')修改后:user=selector.xpath('normalize-space(//*[@id="Con"]/tr[1]/th/text())')
1、使用xpath获取文本内容,有空格或者换行就用normalize-space()方法例:
2、或者:normalize-space()例子:原来的xpath为:user=selector.xpath('//*[@id="Con"]/tr[1]/th/text()')修改后:user=selector.xpath('normalize-space(//*[@id="Con"]/tr[1]/th/text())')