Possible Duplicate:
Reading a File into a Dictionary And Keeping Count
I am trying to create a dictionary with two values: the first value is the text:
<NEW ARTICLE>
Take a look at
what I found.
<NEW ARTICLE>
It looks like something
dark and shiny.
<NEW ARTICLE>
But how can something be dark
and shiny at the same time?
<NEW ARTICLE>
I have no idea.
and the second value is the count of how many times the word “ARTICLE>” is used.
I tried different methods and one method I received this error:
The erorr I receive is this:
(key, val) = line.split()
ValueError: need more than 1 value to unpack
I’ve tried a few different methods but to no avail, one method I tried said it gave too many values to unpack..
I want to be able to search for a key/word in the dictionary later on and find its appropriate count.
Using Python 3.
this should do it: