利用三个冒号的方法达到特殊字符不用转义
作者:互联网
#!/usr/bin/python
timesnap = 1558454400000
calc_days = 16
start_month = 5
start_day = 22
num =22
start_m_days=31
for j in range(calc_days) :
if start_day +1+j>start_m_days:
print """INSERT INTO `br_sdk_druid`.`t_sdk_act_config_task` ( `name`, `type`, `create_time`, `update_time`, `info`, `status`) VALUES ( 'RETAINED@linlhTEST@"""+str(timesnap+j*24*60*60*1000)+"""', '1', '2019-"""+str(start_month+1).zfill(2)+'-'+str(start_
day+1+j-start_m_days).zfill(2)+""" 02:00:00', '2019-"""+str(start_month+1).zfill(2)+'-'+str(start_day+1+j-start_m_days).zfill(2)+"""', '{\"baseInput\":\"/data/br/base/action/inputpath/source/liujun"""+str(num)+"""/2019/"""+str(start_month+1).zfill(2)+'/'+str(start_day
+1+j-start_m_days).zfill(2)+"""\",\"baseOutput\":\"/data/br/base/action/inputpath/result/liujun"""+str(num)+"""/2019/"""+str(start_month+1).zfill(2)+'/'+str(start_day+1+j-start_m_days).zfill(2)+"""/RETAINED\",\"configMap\":{},\"gran\":\"DAY\",\"monitorTime\":"""+str(t
imesnap+j*24*60*60*1000)+""",\"mrTypeName\":\"RETAINED\"}', '2');"""
else:
print """INSERT INTO `br_sdk_druid`.`t_sdk_act_config_task` ( `name`, `type`, `create_time`, `update_time`, `info`, `status`) VALUES ( 'RETAINED@linlhTEST@"""+str(timesnap+j*24*60*60*1000)+"""', '1', '2019-"""+str(start_month).zfill(2)+'-'+str(start_da
y+1+j).zfill(2)+""" 02:00:00', '2019-"""+str(start_month).zfill(2)+'-'+str(start_day+1+j).zfill(2)+"""', '{\"baseInput\":\"/data/br/base/action/inputpath/source/liujun"""+str(num)+"""/2019/"""+str(start_month).zfill(2)+'/'+str(start_day+1+j).zfill(2)+"""\",\"baseOutpu
t\":\"/data/br/base/action/inputpath/result/liujun"""+str(num)+"""/2019/"""+str(start_month).zfill(2)+'/'+str(start_day+1+j).zfill(2)+"""/RETAINED\",\"configMap\":{},\"gran\":\"DAY\",\"monitorTime\":"""+str(timesnap+j*24*60*60*1000)+""",\"mrTypeName\":\"RETAINED\"}',
'2');"""
标签:冒号,转义,60,start,zfill,str,month,day,特殊字符 来源: https://www.cnblogs.com/linlianhuan/p/10986850.html