I have a text file which has arrays appended to them
What I want to do is extract it from the text file and work out how many times
index[2]
occurs for each word in the text file. For instance hablar occurs once etc. I will then use that to plot a graph.
The problem is that when i import the file it comes as a list within a list
with open("wrongWords.txt") as file:
array1 = []
array2 = []
for element in file:
array1.append(element)
x=array1[0]
print(x)
Printing x gives me
(12, 'a', 'hablar', 'to speak')(51, 'a', 'ocurrir', 'to occur/happen')(12, 'a', 'hablar', 'to speak')(2, 'a', 'poder', 'to be able')(11, 'a', 'llamar', 'to call/name')