Here's how to manipulate CSV files in [[Python]]. ### The library ```python import csv ``` This is the library you'll need for the functions below. ### Iterate through rows in the CSV file ```python import csv fields = [] rows = [] with open(filename, 'r') as csvfile: csvreader = csv.reader(csvfile) fields = next(csvreader) for row in csvreader: rows.append(row) ``` ### Write to a CSV file ```python import csv fields = ['1', '2', 'tie my shoe'] output_filename = 'output.csv' with open(output_filename, 'w') as output_file: writer = csv.writer(output_file) output_file.write(",".join(fields) + '\n') writer.writerows(rows) ```