Last active
August 29, 2015 13:57
-
-
Save rabbleNaut/9662976 to your computer and use it in GitHub Desktop.
Used for editing a .csv file that was too large for Excel or Access.
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
import csv | |
#removes columns starting at remove_from up to- but *not including* - remove_to | |
remove_from = 239 | |
remove_to = 260 | |
fp_in = open("tx000452010.txt", "rb") | |
fp_out = open("tx000452010_PT1.txt", "wb") | |
reader = csv.reader(fp_in, delimiter=",") | |
writer = csv.writer(fp_out, delimiter=",") | |
x = 1 | |
for row in reader: | |
del row[remove_from:remove_to] | |
writer.writerow(row) | |
print "Editing row: %s" % x #counter and print for visual shell purposes only | |
x += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment