mf1 = open("/Users/koc/Desktop/next.txt", "r") d = {} for s in mf1: t = s.split() d[t[0]] = int(t[1])