Fetching all the strings in a python list of lists
<p>I have this list of lists</p>

<pre><code>a = [[1,2,3,4,'normal'],[1,2,3,4,'abnormal'],[1,2,3,4,'normal'],[1,2,3,4,'ab
normal'],[1,2,3,4,'normal'],[1,2,3,4,'abnormal'],[1,2,3,4,'abnormal'],[1,2,3,4,'
abnormal']]
</code></pre>

<p>I want to extract all the strings perse I have no idea what these strings might be, and count each string occurance.
Is there a simple loop instruction to do that ? </p>

<p>I am not sure to have understood your question (word "perse" is unknown to me) If you want to count the occurence of strings normal and abnormal, I propose that:</p>

<pre><code>from collections import Counter
Counter([elt[4] for elt in a])
</code></pre>

<p>Outputs:</p>

<pre><code>Counter({'abnormal': 5, 'normal': 3})
</code></pre>

python list