linnad={} for rida in open("teed1.txt", "r"): m=rida.strip().split() linnad[m[0]]=m[1:] print(linnad) print(linnad["Tartu"])