v1t=open("v1.txt", encoding="utf-8").readlines() kohad=open("kohanimed_eesti_koordinaadid_kogused_sort.txt", encoding="utf-8") d={} for rida in kohad: m=rida.strip().split(",") d[m[0].lower()]=m[1:3] #print(d) f2=open("v1lisa.txt", "w", encoding="utf-8") for rida in v1t: m=rida.strip().split(",") if len(m)<6: if m[2] in d: m+=d[m[2]] print(*m, sep=",", file=f2) f2.close()