From e94df333431d0700001ae03ced2110d5213111ef Mon Sep 17 00:00:00 2001 From: s45452 Date: Sat, 9 Dec 2017 16:46:22 +0100 Subject: [PATCH] lab3 zadanie 5 --- labs03/labs_zadanie5.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 labs03/labs_zadanie5.py diff --git a/labs03/labs_zadanie5.py b/labs03/labs_zadanie5.py new file mode 100644 index 0000000..f2847a5 --- /dev/null +++ b/labs03/labs_zadanie5.py @@ -0,0 +1,34 @@ +import os +#a =[] + +#plik = file = open("model.iter10000.npz.bleu", "r") +#print(plik) + +def open_plik(source, file): + plik=file = open(os.path.join(source, file), "r") + #plik = file = open(file, "r") + for linia in plik.readlines(): + #print(linia.strip()) + test = linia.split(',') + test2 = test[0] + test3 = test2.split('=') + test4 = float(test3[1]) + plik.close() + return(test4) + +sub_dir = "J:\\PycharmProjects\\Python2017\\labs03\\scores" +Folder_list = os.listdir (sub_dir) +print(Folder_list) +value=0.0 +for i in Folder_list: + #print(i) + file = i + print(file) + check=float(open_plik(sub_dir,file)) + print(check,value) + if check>value: + file_name=os.path.join(sub_dir, file) + value= check + else: + pass +print("poprawna wartosc", value,"FILE:",file_name)