From 2c0fdb13c795118653e930e5ec2329bddaa41926 Mon Sep 17 00:00:00 2001 From: MG-5 Date: Tue, 25 Oct 2022 00:11:40 +0200 Subject: [PATCH] Use better variant to get the last element --- edit_data_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edit_data_form.py b/edit_data_form.py index 605f18c..7c41f17 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -78,7 +78,7 @@ def main(*_args): # we want the latest json file in given folder filesList = [f for f in os.listdir(file_path) if os.path.isfile(os.path.join(file_path, f)) and f.endswith(".json")] filesList.sort() - file_path = os.path.join(file_path, filesList[len(filesList) - 1]) + file_path = os.path.join(file_path, filesList[-1]) else: print("Please enter a valid json file or the directory containing the json file!")