巴扎黑2017-04-18 10:12:04
Use strip() to remove leading and trailing spaces
from scrapy.selector import Selector
content = "<p>数量:100-200个 </p>"
strings = Selector(text=content).xpath('//p/text()').re_first(u'数量:(.+)\s$').strip()
print(strings)
print(len(strings))
"""
100-200个
8
"""