1 外面双引号,里面单引号不要转义,%要转义%%。

cur.execute("select * from tag_users where name like '%%"+name+"%%'")

2 或者以参数的形式,2种不同的参数传法见引用

http://blog.csdn.net/shellshine/article/details/8207448   python向mysql插入特殊字符

cur.execute("select * from tag_users where name like '%%%s%%'"%(word))

 

相关文章:

  • 2021-10-04
  • 2022-02-06
  • 2022-12-23
  • 2021-11-29
  • 2021-08-04
  • 2021-11-06
  • 2022-12-23
  • 2021-10-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
相关资源
相似解决方案