Scrapy text filter

抓取文本容易遇到 一些node  , such as  <br>  \n   \t   等空字符,去除方法很多:

way 1 :   [i for i in [ i.strip() for i in result] if i !='' ]

way 2 :  [ i.strip() for i in result  if not i.strip()]

way3 :  引入ItemLoader 模块  ,Mapcompose(unicode.strip())([list])

猜你喜欢

转载自blog.csdn.net/coolervschanger/article/details/82712447