From e1b2657ff022c959cc10146c6d50a95e11527c05 Mon Sep 17 00:00:00 2001 From: Jochen Kupperschmidt Date: Sun, 5 Jun 2016 22:24:48 +0200 Subject: [PATCH] Open file via `with` statement so it gets closed automatically. --- gitfiti.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gitfiti.py b/gitfiti.py index 7f2c67864..f2459d93d 100755 --- a/gitfiti.py +++ b/gitfiti.py @@ -303,9 +303,8 @@ def fake_it(image, start_date, username, repo, offset=0, multiplier=1, def save(output, filename): """Saves the list to a given filename""" - f = open(filename, "w") - f.write(output) - f.close() + with open(filename, "w") as f: + f.write(output) def main():