Skip to content

Instantly share code, notes, and snippets.

@cluther
Last active November 7, 2017 16:36
Show Gist options
  • Save cluther/a28116631f4fb9ddabe4e4f1c790b8fd to your computer and use it in GitHub Desktop.
Save cluther/a28116631f4fb9ddabe4e4f1c790b8fd to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
# Example of using Python's csv module.
#
# Usage:
#
# python csv-example.py < input.csv
import csv
import sys
reader = csv.reader(sys.stdin)
writer = csv.writer(sys.stdout)
for inrow in reader:
outcol1 = "".join(inrow[0:3])
outcol2 = inrow[3]
writer.writerow([outcol1, outcol2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment