当前位置:
首页 >
python拼接mysql时遇到unsupported format character ‘?‘ “(0x82f1)“
发布时间:2025/3/15
51
豆豆
生活随笔
收集整理的这篇文章主要介绍了
python拼接mysql时遇到unsupported format character ‘?‘ “(0x82f1)“
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
因为%也是需要转义的字符,所以要再加一个%
def getIDResultFromMysql():yc=str('\'%%英超%%\'')xj=str('\'%%西甲%%\'')dj=str('\'%%德甲%%\'')fj=str('\'%%法甲%%\'')yj=str('\'%%意甲%%\'')query_condition=' and (match_type like ' + yc +' or match_type like '+xj+' or match_type like '+yj+' or match_type like '+dj+' or match_type like '+fj+')'sql = 'SELECT match_id, TIME ,day FROM today_match_detail WHERE TIME < NOW() AND TIME > DATE_SUB(NOW(), INTERVAL 2.5 HOUR)'+query_conditionprint(sql)总结
以上是生活随笔为你收集整理的python拼接mysql时遇到unsupported format character ‘?‘ “(0x82f1)“的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 2021新茶饮研究报告
- 下一篇: 产品经理必知必会的SQL