I want to convert all words in a standard dictionary (for example : /usr/share/dict/words of a unix machine) integer and find XOR between every two words in the dictionary( ofcourse after converting them to integer) and probably store it in a new file.
Since I am new to python and because of large file sizes, the program is getting hung every now and then.
import os
dictionary = open("/usr/share/dict/words","r")
'''a = os.path.getsize("/usr/share/dict/words")
c = fo.read(a)'''
words = dictionary.readlines()
foo = open("word_integer.txt", "a")
for word in words:
foo.write(word)
foo.write("\t")
int_word = int(word.encode('hex'), 16)
'''print int_word'''
foo.write(str(int_word))
foo.write("\n")
foo.close()