From 9dbc9fc89d2a77262fe60ee2ea3949288f8ce541 Mon Sep 17 00:00:00 2001 From: Antoine Van Elstraete Date: Mon, 24 Jan 2022 16:52:59 +0100 Subject: [PATCH] Ouvre le dictionnaire avec un 'with statement' --- wgamesolv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wgamesolv.py b/wgamesolv.py index 47e68db..0077335 100755 --- a/wgamesolv.py +++ b/wgamesolv.py @@ -63,10 +63,9 @@ args = parser.parse_args() # Dictionary if args.dictionary: - fp = args.dictionary try : - f = open(fp) - liste = json.load(f) + with open(args.dictionary, "r") as dico: + liste = json.load(dico) except: print("Impossible d'ouvrir le fichier" + fp)