notepad++ pythonScript插件之列转SQL查询条件

import StringIO

def DelLastChar(str):
    str_list=list(str)
    str_list.pop()
    return "".join(str_list)


allText = editor.getText()
selectText = editor.getSelText() 
lineIndex = 0
javaText = "("
for line in StringIO.StringIO(selectText):
    line = "'"+line.replace("\r\n","")+"',"
    javaText =  javaText + line
    lineIndex = lineIndex + 1
    console.write(line)
javaText = DelLastChar(javaText)
javaText = javaText + ")"
editor.setText(javaText)
editor.selectAll()
editor.copy()
editor.setText(allText)

你可能感兴趣的:(python,工具)