python報錯“must be str, not int”
阿新 • • 發佈:2018-12-08
for i in range(3):
j=i+1
sqlstr=" insert into T_DATA_RISK(STATIONCODE,MONIDATE,RATE_PM25,RATE_NO2,STYLE)\
select a.id,a.recordtime,a.pm25/25.0 RATE_PM25,[dbo].[RiskData](a.no2,1) RATE_NO2,"+j+" STYLE \
from T_MIC_DATAAIRDAY a join T_MIC_STATION b on a.id=b.id \
where b.stationtype=2 and a.recordtime='"+monidate+"'"
修改如下
新增引用
import json
for i in range(3):
j=i+1
j=json.dumps(j)
print(j)
sqlstr=" ....."
參考https://jingyan.baidu.com/article/adc81513a75bcaf723bf73a0.html