python - 正则表达式匹配“\xa0”的问题
伊谢尔伦
伊谢尔伦 2017-04-18 10:10:04
0
2
422
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
巴扎黑

Use strip() to remove leading and trailing spaces

from scrapy.selector import Selector

content = "<p>数量:100-200个&nbsp;&nbsp;&nbsp;&nbsp;</p>"
strings = Selector(text=content).xpath('//p/text()').re_first(u'数量:(.+)\s$').strip()
print(strings)
print(len(strings))
"""
100-200个
8
"""
伊谢尔伦

'数量:(S+)'

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!