Created
July 31, 2012 08:18
-
-
Save dmnc-net/3214869 to your computer and use it in GitHub Desktop.
fixed width text file to CSV converter
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/python | |
import sys | |
import csv | |
rf = open(sys.argv[1]) #input file handle | |
wf = open(sys.argv[2],'w') #output file handle | |
writer = csv.writer(wf) | |
for row in rf.readlines(): | |
writer.writerow(row.split()) | |
rf.close() # close input file handle | |
wf.close() # close output file hanle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment