File Parsing problem
<p>I have a question about my homework problem. Here is the problem: 
Write a program which reads a text file called input.txt which contains an arbitrary number of lines of the form ", " then records this information using a dictionary, and finally outputs to the screen a list of countries represented in the file and the number of cities contained.</p>

<p>For example, if input.txt contained the following:</p>

<p>New York, US<br />
Angers, France<br />
Los Angeles, US<br />
Pau, France<br />
Dunkerque, France<br />
Mecca, Saudi Arabia</p>

<p>The program would output the following (in some order):</p>

<p>Saudi Arabia : 1<br>
US : 2<br>
France : 3</p>

<p>Here is my Code: </p>

<pre><code>def addword(w,wcDict):
    if w in wcDict:
        wcDict[w] +=1
    else:
        wcDict[w]= 1

import string
def processLine(line, wcDict):
    wordlist= line.strip().split(",")
    for word in wordlist:
        word= word.lower().strip()
        word=word.strip(string.punctuation)
        addword(wordlist[1], wcDict)

def prettyprint(wcDict):
    valkeylist= [(val,key) for key,val in wcDict.items()]
    valkeylist.sort(reverse = True)
    for val,key in valkeylist:
        print '%-12s    %3d'%(key,val)

def main():
    wcDict={}
    fobj= open('prob1.txt','r')
    for line in fobj:
        processLine(line, wcDict)
    prettyprint (wcDict)

 main()
</code></pre>

<p>My code counts each country twice. Can you please help me?</p>

<p>Thank you</p>
