Skip to content

Instantly share code, notes, and snippets.

@yfwu
Forked from 101001417/tsv2csv
Last active April 7, 2016 14:36
Show Gist options
  • Save yfwu/9a33a899a4ec0b45c7120274087c60e0 to your computer and use it in GitHub Desktop.
Save yfwu/9a33a899a4ec0b45c7120274087c60e0 to your computer and use it in GitHub Desktop.
tsv2csv
import csv
# he underlying Windows text file mechanism cuts in and changes that \n to \r\n ... total effect: \r\r\n
# Refs: http://stackoverflow.com/questions/1170214/pythons-csv-writer-produces-wrong-line-terminator/1170297#1170297
with open('AllNet5.csv', 'w') as out:
reader = csv.reader(open('AllNet5.net', 'r'), delimiter="\t")
for row in reader:
out.write(','.join(row) + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment