How to count the number of times a word appears in each row of a csv file, in python
<p>I have a csv document in which each row contains a string of words. For each row, I want to know how many times each words appears in that row, how would I go about this?</p>

<p>Thanks</p>

<p>Move the row to a list, make it unique and count every object in list,</p>

<p>For converting to list <a href="http://stackoverflow.com/questions/7844118/how-to-convert-comma-delimited-string-to-list-in-python">Check this</a></p>

<p>if result is more than one, print it.</p>

<p>Considered this as list <code>['a','b','a','c']</code></p>

<pre><code>z=['a','b','a','c']
u=set(z)
for i in u:
    if z.count(i)&gt;1: print i,z.count(i)
</code></pre>

<p>Output:</p>

<pre><code>`a 2` 
</code></pre>

python csv