python mysql like查询的写法

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))