extra rows in a CSV module output when viewed in excel 2007

JonathanB doulos05 at gmail.com
Fri Aug 13 02:22:23 EDT 2010


The subject basically says it all, here's the code that's producing
the csv file:

    def write2CSV(self,output):
        writer = csv.writer(open(output, 'w'), dialect='excel')
        writer.writerow(['Name','Description','Due Date','Subject',
                         'Grade','Maximum Grade', self.name,
self.grade])
        for row in self.assignment_list:
            writer.writerow(row.output2list())
        return True

Here's the text from the csv file my test-run outputs:

Name,Description,Due Date,Subject,Grade,Maximum Grade,Test Student,2
Math Homework 8/21,Math Review pp. 103-104,2010-08-13,Math,10,10,,
Math Test,Chapter 5,2010-09-21,Math,45,50,,
Science Test,Matter,2010-09-11,Science,400,500,,

When I view it in Excel, there's an extra row between every result.
How can I remove those?



More information about the Python-list mailing list