Larry Hudson yahoo.com.dmarc.invalid> writes:
>
> On 10/04/2014 10:36 AM, Shiva wrote:
> >
> > What I don't understand is:
> >
> > for w in eachword:
> > textstorage[w]=textstorage.get(w, 0) + 1
> >
> > How does textstorage.get(w,0)+1 give the count of the word??
> >
>
> Very long
On 2014-10-05 02:11, Denis McMahon wrote:
On Sat, 04 Oct 2014 09:11:43 +, Shiva wrote:
I have written a function that -reads a file -splits the words and
stores it in a dictionary as word(key) and the total count of word
in file (value).
I want to print the words with top 20 occurrences in
On Sat, 04 Oct 2014 09:11:43 +, Shiva wrote:
> I have written a function that -reads a file -splits the words and
> stores it in a dictionary as word(key) and the total count of word in
> file (value).
>
> I want to print the words with top 20 occurrences in the file in reverse
> order - but
On 10/04/2014 10:36 AM, Shiva wrote:
What I don't understand is:
for w in eachword:
textstorage[w]=textstorage.get(w, 0) + 1
How does textstorage.get(w,0)+1 give the count of the word??
Very long-winded explanation: (But to shorten it a bit, I'm going to use ts in place of
t
On 2014-10-04 18:36, Shiva wrote:
> It works :
> orderedwords = sorted(textstorage.keys(), key=textstorage.get)
>
> The method textstorage.get will accept a word and return it's value
> which in this instance is the count.
>
> What I don't understand is:
>
> for w in eachword:
> text
It works :
orderedwords = sorted(textstorage.keys(), key=textstorage.get)
The method textstorage.get will accept a word and return it's value which in
this instance is the count.
What I don't understand is:
for w in eachword:
textstorage[w]=textstorage.get(w, 0) + 1
How does textsto
Am 04.10.2014 um 11:11 schrieb Shiva:
> Hi All,
>
> I have written a function that
> -reads a file
> -splits the words and stores it in a dictionary as word(key) and the total
> count of word in file (value).
>
> I want to print the words with top 20 occurrences in the file in reverse
> order -
Shiva wrote:
> Hi All,
>
> I have written a function that
> -reads a file
> -splits the words and stores it in a dictionary as word(key) and the total
> count of word in file (value).
>
> I want to print the words with top 20 occurrences in the file in reverse
> order - but can't figure it out.
Hi All,
I have written a function that
-reads a file
-splits the words and stores it in a dictionary as word(key) and the total
count of word in file (value).
I want to print the words with top 20 occurrences in the file in reverse
order - but can't figure it out. Here is my function:
def prin