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+",

很简单,不解释

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。