4
I would like to count how many times a word list (archive1) appears in another word list (archive2)
with open("corpus.txt", "r") as f1, open("lexico.txt", "r") as f2:
file1 = f1.read()
file2 = f2.read()
corpus1 = file1.split(" ")
for word in file2:
print(word, corpus1.count(word))
corpus.txt file (archive2)
I am afraid to look for other options for the quality of light is quite recommendable very white light, but the duration of everything opposite I lasted less than months the two lamps and I put them in the assist light. The light I want is paler but strong enough to light the room.
lexico.txt file (archive1)
is
but
light
Upshot
is 2
0
m 0
to 2
s 0
0
l 0
u 0
z 0
0
In lexico.txt words are separated by " n" (line break), always? That is, one word per line?
– Miguel
Always separated by a line break! I tried to make a corpus2 = file2.split(" n") but it didn’t work.
– pitanga