Created
December 8, 2011 16:27
-
-
Save drincruz/1447503 to your computer and use it in GitHub Desktop.
I needed a quick and easy way to print specific csv columns for my life on the command line...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import csv | |
import sys | |
if 3 > len(sys.argv): | |
sys.exit("Usage: %s <csv_file> <column_to_print>" % sys.argv[0]) | |
fileparse = csv.reader(open(sys.argv[1])) | |
for f in fileparse: | |
print f[int(sys.argv[2])] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment