forked from tdwojak/Python2017
lab3 zadanie 5
This commit is contained in:
parent
323a314885
commit
e94df33343
34
labs03/labs_zadanie5.py
Normal file
34
labs03/labs_zadanie5.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user