How can I find the position in a list where an item differs from the previous item?
<pre><code>l1 = [1,2,2,2]
</code></pre>

<p>In the list above, I know that the element differs in l1[0]. Is there any way to find the position in python?</p>

<p>Try this:</p>

<pre><code>l1 = [1,2,2,2]

for pos, i in enumerate(l1):
    if l1.count(i)==1:      
        print pos
</code></pre>

python