From af7be28781404559878ce578c99e8b48db4f8792 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 5 Feb 2013 10:01:49 -0500 Subject: [PATCH] Add trailing newlines to saved JSON files --- quizzer/answerdb.py | 1 + quizzer/quiz.py | 1 + 2 files changed, 2 insertions(+) diff --git a/quizzer/answerdb.py b/quizzer/answerdb.py index 869641e..7ba4ba7 100644 --- a/quizzer/answerdb.py +++ b/quizzer/answerdb.py @@ -34,6 +34,7 @@ class AnswerDatabase (dict): with self._open(mode='w', **kwargs) as f: _json.dump( data, f, indent=2, separators=(',', ': '), sort_keys=True) + f.write('\n') def add(self, question, answer, correct): if question.prompt not in self: diff --git a/quizzer/quiz.py b/quizzer/quiz.py index f0250c7..86b029a 100644 --- a/quizzer/quiz.py +++ b/quizzer/quiz.py @@ -40,3 +40,4 @@ class Quiz (list): with self._open(mode='w', **kwargs) as f: _json.dump( data, f, indent=2, separators=(',', ': '), sort_keys=True) + f.write('\n') -- 2.26.2