DEV Community

loading...

csvcheck.py

yujiri8 profile image Ryan Westlund ・1 min read

I develop a web app that offers CSV exports of customer data. I often need to inspect the CSV files after a change to make sure they work. But looking at CSV in a text editor is kinda bleh, it's hard to tell which value is in which column. And using a document viewer is BLEH. I hate those things. So I wrote this Python script to help me check them.

import csv, sys
with open(sys.argv[1]) as f:
    row = csv.DictReader(f).__iter__().__next__()
    for col in row:
        print(col, ':', row[col])
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

pic
Editor guide