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