forked from tdwojak/Python2017
35 lines
878 B
Python
35 lines
878 B
Python
|
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)
|