diff --git a/grab.py b/grab.py index 43e8f81..88b5b62 100755 --- a/grab.py +++ b/grab.py @@ -42,6 +42,5 @@ while True: reddit = json.load(http) sleep(1) -f = open('data.json', 'w') -json.dump(datum, f) -f.close() +with open('data.json', 'w') as f: + json.dump(datum, f)