Re: [Tutor] Most common words in a text file

2017-10-01 Thread Mats Wichmann
On 09/30/2017 11:12 AM, Sri G. wrote: > I'm learning programming with Python. > > I’ve written the code below for finding the most common words in a text > file that has about 1.1 million words. It's working fine, but I believe > there is always room for improvement. > > When run, the function

Re: [Tutor] Most common words in a text file

2017-10-01 Thread Alan Gauld via Tutor
On 30/09/17 18:12, Sri G. wrote: > import sysimport collections I assume that should be two lines? But you can also import multiple modules on a single line. import sys, collections Although some folks don't like that style. > def find_most_common_words(textfile, top=10): > ''' Returns

Re: [Tutor] Most common words in a text file

2017-10-01 Thread Mark Lawrence via Tutor
On 30/09/2017 18:12, Sri G. wrote: I'm learning programming with Python. I’ve written the code below for finding the most common words in a text file that has about 1.1 million words. It's working fine, but I believe there is always room for improvement. When run, the function in the script

Re: [Tutor] Most common words in a text file

2017-09-30 Thread Cameron Simpson
On 30Sep2017 22:42, Sri G. wrote: I’ve written the code below for finding the most common words in a text file that has about 1.1 million words. It's working fine, but I believe there is always room for improvement. When run, the function in the script gets a text file

[Tutor] Most common words in a text file

2017-09-30 Thread Sri G.
I'm learning programming with Python. I’ve written the code below for finding the most common words in a text file that has about 1.1 million words. It's working fine, but I believe there is always room for improvement. When run, the function in the script gets a text file from the command-line