Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
show CSV with zenipy
import zenipy
myfile = "/path/to/file.csv"
csv = open(myfile, "r").read().splitlines()
header = "\n".join(csv[:1])
columns = header.split("\t")
t = ""
for line in csv[1:]:
values = "".join(line).split("\t")
t += "\n".join(values)
t += "\n"
zenipy.zlist(columns, t.splitlines(), text='', title=myfile, width=1000, height=500, timeout=None)
@Axel-Erfurt

This comment has been minimized.

Copy link
Owner Author

@Axel-Erfurt Axel-Erfurt commented Jan 24, 2021

Version with File selector

from zenipy import file_selection, zlist


def selectFile():
    myfile = file_selection(multiple=False, directory=False, save=False, 
                            confirm_overwrite=False, title='Open CSV', 
                            width=450, height=650, timeout=None)
    if myfile:
        return(myfile)
    else:
        return("") 
        
        
myfile = selectFile()

if not myfile == "":
    csv = open(myfile, "r").read().splitlines()

    header = "\n".join(csv[:1])

    columns = header.split("\t")

    t = ""

    for line in csv[1:]:
        values = "".join(line).split("\t")
        t += "\n".join(values)
        t += "\n"

    zlist(columns, t.splitlines(), text='', title=myfile, width=1000, height=500, timeout=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment