Welcome to Script Showcase

2010-08-08
2013-01-25
  • Welcome to Script Showcase

     
  • If you have a script you'd like to share or showcase, post it here.  If it's long, you can post it at http://npppython.codepad.org/ which will syntax highlight it for you.

     
  • ZorkFanDM
    ZorkFanDM
    2010-09-22

    I wrote this script to make reading .csv data in notepad++ easier after.
    It's not meant to be an excel replacement or anything, just a visual aid.

    a = [[] for x in editor.getLine(1).split(",")]
    def csv_to_list(cont, l_num, tot_lines):
        cont = cont.split(",")
        for n in range(len(cont)): a[n].append(cont[n].replace("\r\n", ""))
    editor.forEachLine(csv_to_list)
    aLens = [max([len(x) for x in a[y]]) for y in range(len(a))]
    def form_line(l_num):
        txt = "".join([a[x][l_num].ljust(aLens[x]+1) for x in range(len(aLens))])
        txt = txt + "\r\n"
        return(txt)
    notepad.new()
    for l in range(len(a[0])-1): editor.addText(form_line(l))
    
     
  • Cool…. thanks for posting biomatchjdaily.  Would you mind posting it in it's own thread, then people can find it easily - subject of CSV Formatting or something.