Skip to content

Instantly share code, notes, and snippets.

@nsonnad
Created November 22, 2013 11:38
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save nsonnad/7598574 to your computer and use it in GitHub Desktop.
Save nsonnad/7598574 to your computer and use it in GitHub Desktop.
Python script for converting tsv to csv
import sys
import csv
tabin = csv.reader(sys.stdin, dialect=csv.excel_tab)
commaout = csv.writer(sys.stdout, dialect=csv.excel)
for row in tabin:
commaout.writerow(row)
@danyaljj
Copy link

How would you use this?

@danyaljj
Copy link

Is it interactive? (in other words, how would you declare where is the input file?)

@Ironjanowar
Copy link

@danyaljj you could do this:

python tsv2csv.py < file_input.tsv > file_output.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment