Matt> I have a CSV file, exported from Excel, that has blank records in Matt> it, and I need to fill them in with the values from the record Matt> just above it until it hits a non-blank value.
Try something like: #!/usr/bin/env python import sys import csv last = {} reader = csv.DictReader(open("test1.csv", "rb")) writer = csv.DictWriter(open("test2.csv", "wb"), sys.stdout, fieldnames="Zone City Event".split()) for row in reader: for key in row: if not row[key]: row[key] = last.get(key, "") writer.writerow(row) last = row Skip -- http://mail.python.org/mailman/listinfo/python-list