Write a Python program that asks user for the name of an input file. The program then reads the content of the input file to find out the frequency of each word appears in the file and write the word frequency in alphabetical order to an output file called word_frequency.txt. Both the input and output file reside in the same directory with the Python file.
In this problem, a word is a sequence of alphanumeric and dash (“-“) characters. Furthermore, we ignore the case differences here, i.e. both “House” and “house” are considered as “house”.
Please sign in to leave a comment.