Python large array comparison
<p>I have a large array containing URL (it can contains 100 000 URL strings), and I would like to know if my actual URL is one of the URL from the array. For that, I have to compare the actual URL string with all the URL string in the array. Is there any way to compare with this large array but with less time than I do now ? For now it's :</p>

<pre><code>error = 0
for oldUrl in urlList:
    error = 1 if oldUrl == actualUrl else error
</code></pre>

<p>To check if a <code>list</code> contains an <code>item</code>, use: <code>item in list</code>.</p>

<p>So, you can write:</p>

<pre><code>error = oldUrl in urlList
</code></pre>

python arrays performance python-2.7 compare