for i in wordList: wordDict[i] = allWord.count(i) print(i + ' ' + str(cnt) + ' ' + str(wordDict[i])) cnt = cnt+1 ##print(wordDict)
Sample input: data.txt
1 2
data.txt: A small sample of texts from Project Gutenberg appears in the corpus collection. However, you may be interested in analyzing other texts from Project Gutenberg. You can browse the catalog of 25,000 free online books at xxx, and obtain a URL to an ASCII text file. Although 90% of the texts in Project Gutenberg are in English, it includes material in over 50 other languages.
Sample output
1 2 3 4 5 6 7 8 9 10 11 12
A 0 1 small 1 1 sample 2 1 of 3 3 texts 4 3 from 5 2 Project 6 3 Gutenberg 7 3 appears 8 1 in 9 5 the 10 3 ...