Prev: looping through possible combinations of McNuggets packs of 6, 9 and 20
Next: How do I get number of files in a particular directory.
From: JonathanB on 13 Aug 2010 02:22 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?
From: alex23 on 13 Aug 2010 02:52
On Aug 13, 4:22 pm, JonathanB <doulo...(a)gmail.com> wrote: > writer = csv.writer(open(output, 'w'), dialect='excel') I think - not able to test atm - that if you open the file in 'wb' mode instead it should be fine. |