######################################################################## ##############Probleme: gestion d'une champiannat de football############ ######################################################################### def init_match(): try: f=open('equipes.txt','r') teams=f.readlines() f.close() except: print('fichier inexistant') match0='{};{};0:0\n' list_match=[] for team in teams: for vs in teams: if team!=vs: list_match.append(match0.format(team.strip(),vs)) f=open('match.txt','w') f.writelines(list_match) f.close() def maj_match(loc,vs,result): f=open('match.txt','r') content=f.read() f.close() motif='{};{};{}' toReplace=motif.format(loc,vs,"0:0") replacement=motif.format(loc,vs,result) content.replace(toReplace,replacement) f=open('match.txt','w') content=f.write(content) f.close() #Task: do the same funtion but using readlines instead of read. def res_match(line): line_details=line.strip().split(';') res=line_details[-1].strip().split(':') if res[0]>res[1]:return '1' elif res[0]