python实现sql字符提取功能

发布时间:2021-01-01编辑:脚本学堂
python实现sql字符提取功能的代码

代码:
 

a="""
dr.GetStr("kh"),
dr.GetStr("xm"),
dr.GetStr("xh"),
dr.GetStr("sfzh"),
dr.GetStr("xbdm"),
dr.GetStr("bjxx"),
dr.GetStr("wyyzdm"),
dr.GetStr("hkszd"),
dr.GetStr("mzdm"),
dr.GetStr("zzmmdm"),
dr.GetStr("ykh"),
dr.GetStr("kssj"),
dr.GetStr("jssj"),
dr.GetStr("ksh"),
dr.GetStr("kldm")
);
mydb.InsertXskcbj(
dr.GetStr("kh"),
dr.GetStr("kslxdm"),
dr.GetStr("ksccdm"),
dr.GetStr("ksxh"),
dr.GetStr("nf"),
dr.GetStr("qh"),
dr.GetStr("xxdm"),
dr.GetStr("bjxx"),
dr.GetStr("hbxx")
);
mydb.InsertCkxx(
dr.GetStr("kh"),
dr.GetStr("nf"),
dr.GetStr("kslxdm"),
dr.GetStr("ksccdm"),
dr.GetStr("ksxh")"""
b = a.splitlines()
c = []
for i in b:
    index = i.find('"')
    if index != -1:
        end = i.find('"',index + 1)
        r = i[index+1:end]
        if r in c:
            pass
        else:
            c.append(r)

for i in c:
    print '"'+i+'",'