self.content = re.sub(r'>|<',lambda x: '&gt' if x.group()[0] == '>' else '&lt' , self.content) #content是要匹配的内容,lambda函数才是真正的替换

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2022-03-02
  • 2021-07-07
  • 2022-01-18
  • 2022-02-26
  • 2022-01-17
  • 2021-08-09
猜你喜欢
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
相关资源
相似解决方案