Skip to main content

10.12) Challenge 29 (Extra Hard) - File Indexer


Write a program which creates an index from the text file: TheTyger_WilliamBlake.txt

The index records the occurrences of each word in the text and the line(s) at which the words occur.

Write the index in a text file with each word on one line followed by the list of lines. Words should be in alphabetical order.

For example:

a: 4 9
the: 6 9 12

Hint: The punctuation can get in the way.

Solution: challenge_file_indexing.py