Hi there
I have some problem in creating a code.


I have two text files one of them is English to spanish.txt and the other is English to Italiani.txt. I have to create language translator to convert an English word to either an Italian word or a Spanish word.

I've tried this code to open 1 txt. file, but I don't know how to open two file in one code and compair the words to find the similar word as explaind above

words_list = []
the_file = file("English to Italiani.txt")
for line in the_file:
        words_list = words_list + line.split()
print words_list

thank you

If you are looking for the same English word in both files, use one set for each file and then you can get the difference or intersection of the sets. http://en.wikibooks.org/wiki/Python_Programming/Sets To read two files, you open the first file, process it (add to the set or whatever), and then close it. Then open the second file and repeat the process http://diveintopython.org/file_handling/file_objects.html

commented: Good guidance without ready answer +2