ADS/addstatus.py

45 lines
1.3 KiB
Python
Raw Normal View History

2021-10-11 14:26:49 +02:00
def isWon(result, rev=False):
# print(result)
result = result.split(":")
if(int(result[0])==int(result[1])):
return 2
if(int(result[0])>int(result[1])):
return 1 if not rev else 0
else:
return 0 if not rev else 1
def createFile(clubNumber, clubShrt, startYear, stopYear):
f1 = open("spotkaniaf"+startYear+stopYear+"k"+clubNumber+".txt", "r", encoding="utf8")
f1f = open("spotkaniafw"+startYear+stopYear+"k"+clubNumber+".txt", "w", encoding="utf8")
for line in f1:
line = line.replace("\n","")
row = line.split("\t")
if(len(row)>1):
print(row)
if(row[2]==clubShrt):
line = line + "\t" + str(isWon(row[4]))
else:
line = line + "\t" + str(isWon(row[4], True))
line = line + "\n"
f1f.write(line)
f1.close()
f1f.close()
2021-10-11 15:31:08 +02:00
startYear = "2018"
stopYear = "2019"
2021-10-11 14:26:49 +02:00
f = open("frekwencja"+startYear+stopYear+".txt", "r", encoding="utf8")
tab = []
for line in f:
cols = line.split("\t")
tab.append(cols)
# print(line)
# print(cols)
# print(tab)
2021-10-11 15:31:08 +02:00
createFile("1","CRA",startYear,stopYear)
createFile("2","PIA",startYear,stopYear)
createFile("3","LEG",startYear,stopYear)