1、问题描述:

      实现定位<h2>品牌</h2>节点

      brand_tag = sel.xpath("//h2[text()= '品牌']")

      报错:ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

2、解决方法:

   (1)brand = u'品牌'
           brand_tag = sel.xpath("//h2[text()= '%s']"%(brand))

   (2)brand_tag = sel.xpath(u"//h2[text()= '品牌']")

1、问题描述:

unicode字符转换为中文

  
https://blog.csdn.net/xiaocy66/article/details/83479734


 

相关文章:

  • 2022-02-21
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2021-08-01
  • 2021-06-23
  • 2022-12-23
  • 2022-01-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
  • 2021-05-30
  • 2022-03-10
  • 2022-01-04
  • 2022-12-23
相关资源
相似解决方案