Skip to content

Commit 5c3f7f3

Browse files
authored
Merge pull request #10 from David-Billingsley/patch-1
Fixed CSV file Save. Closes #9.
2 parents fe728b6 + 2f54078 commit 5c3f7f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Chapter05/csv_editor.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ def removeRows(self, position, rows, parent):
8585

8686
# method for saving
8787
def save_data(self):
88-
with open(self.filename, 'w', encoding='utf-8') as fh:
88+
# commented out code below to fix issue with additional lines being added after saving csv file from the window.
89+
# with open(self.filename, 'w', encoding='utf-8') as fh:
90+
with open(self.filename, 'w', newline='', encoding='utf-8') as fh:
8991
writer = csv.writer(fh)
9092
writer.writerow(self._headers)
9193
writer.writerows(self._data)

0 commit comments

Comments
 (0)