I am having a hard time conducting a top 15 word count (Word Count for each word) for the document, Wuthering Heights (https://www.gutenberg.org/files/768/768.txt) on Google Colab. It can only include the words that start after “ccx074@pglaf.org” and end before “END OF THE PROJECT GUTENBERG EBOOK WUTHERING HEIGHTS. This is the coding that I tried.
file = open(768.txt,'r+')
wordcount = {}
for word in file.read().split():
if word not in wordcount:
wordcount[word] = 1
else:
wordcount[word] +=1
for k,v in wordcount.items():
print(k,v)