Using alphabet as counter in a loop
<p>I am looking for the most efficient way to count the number of letters in a list. I need something like</p>

<pre><code>word=[h e l l o]

for i in alphabet:
   for j in word:
      if j==i:
         ## do something
</code></pre>

<p>Where <em>alphabet</em> should be the <strong>spanish</strong> alphabet, that is the english alphabet including the special character <em>'Ã±'</em>.</p>

<p>I have thought about creating a list of pairs in the form of [[a, 0], [b,1], ...] but I suppose there is a more efficient/clean way.</p>

<p>This is pretty easy:</p>

<pre><code>import collections
print collections.Counter("seÃ±or")
</code></pre>

<p>This prints:</p>

<pre><code>Counter({'s': 1, 'r': 1, 'e': 1, '\xa4': 1, 'o': 1})
</code></pre>

python list character