n = {} for line in open('french.txt'): english, french = line.split() n[english] = french n2 = {} for line in open('french.txt'): french, english = line.split()[::-1] n2[french] = english n.update(n2) for k, v in n.items(): print(k, ':', v)
Python | Nifty lil thang
Well, this could come in useful soon.