Ouvre le dictionnaire avec un 'with statement'
This commit is contained in:
parent
57c87fe986
commit
9dbc9fc89d
@ -63,10 +63,9 @@ args = parser.parse_args()
|
|||||||
|
|
||||||
# Dictionary
|
# Dictionary
|
||||||
if args.dictionary:
|
if args.dictionary:
|
||||||
fp = args.dictionary
|
|
||||||
try :
|
try :
|
||||||
f = open(fp)
|
with open(args.dictionary, "r") as dico:
|
||||||
liste = json.load(f)
|
liste = json.load(dico)
|
||||||
except:
|
except:
|
||||||
print("Impossible d'ouvrir le fichier" + fp)
|
print("Impossible d'ouvrir le fichier" + fp)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user