python ValueError: unsupported format character ''' (0x27) at index 224

xiaoxiao2021-02-28  89

问题:将sql语句从mysql复制到python,报错 ValueError: unsupported format character ''' (0x27) at index 224

 

sql = "select   concat(round(bid_rate*100,2),'%') as bid_rate from platform_bid_day where section BETWEEN  '%s' and  '%s' ORDER BY section  " % (st,et)  

解决:将%换成%%,如下

sql = "select   concat(round(bid_rate*100,2),'%%') as bid_rate from platform_bid_day where section BETWEEN  '%s' and  '%s' ORDER BY section  " % (st,et)

 

转载请注明原文地址: https://www.6miu.com/read-32244.html

最新回复(0)