Apr-25-2017, 08:18 PM
I did finally figure out how to read the csv and write new values to csv using my test file. Thanks for all your help!
Now when I try this on a 1 gig csv file, I run into memory error. I know there are ways to do this in chunks, but that should be a question in a new thread.
Now when I try this on a 1 gig csv file, I run into memory error. I know there are ways to do this in chunks, but that should be a question in a new thread.
import csv new_rows_list = [] # Read File f1 = open('in_file', 'r') reader = csv.reader(f1, delimiter=',') for row in reader: new_row = ([col.replace(',', '^') for col in row]) new_rows_list.append(new_row) # Write File f2 = open('out_file', 'w') writer = csv.writer(f2) writer.writerows(new_rows_list) f2.close() f1.close()