From b7998d50b80c6229004f4c9ec629c778937e852d Mon Sep 17 00:00:00 2001 From: naelsondouglas Date: Tue, 2 Nov 2021 20:55:45 -0300 Subject: [PATCH] Removed a manual file handler pitfall --- benchmarks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/benchmarks.py b/benchmarks.py index 3ff23bba..f628194c 100644 --- a/benchmarks.py +++ b/benchmarks.py @@ -7,7 +7,8 @@ iterations = 100000 -reader = csv.DictReader(open('data/titledata.csv'), delimiter='|') +with open('data/titledata.csv') as stream: + reader = csv.DictReader(stream, delimiter='|') titles = [i['custom_title'] for i in reader] title_blob = '\n'.join(titles)