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
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user