From: W. Trevor King Date: Tue, 5 Feb 2013 15:01:49 +0000 (-0500) Subject: Add trailing newlines to saved JSON files X-Git-Tag: v0.1~70 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=af7be28781404559878ce578c99e8b48db4f8792;p=quizzer.git Add trailing newlines to saved JSON files --- 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')