pymysql 查询datetime格式数据报错 query = query % self._escape_args(args, conn) ValueError: unsupported format character 'Y' (0x59) at index 80

   query = query % self._escape_args(args, conn) ValueError: unsupported format character 'Y' (0x59) at index 80

   如上,查询sql  select id,DATE_FORMAT(update_date,'%Y-%m-%d %H:%i:%s') update_date from tpk;

执行这个查询的时候报错,将单个%改为%%即可  DATE_FORMAT(update_date,'%%Y-%%m-%%d %%H:%%i:%%s')

posted @ 2022-07-28 17:23  kakaok  阅读(850)  评论(0编辑  收藏  举报