How to use multiprocessing in a for loop - python
<p>I have a script that use python mechanize and bruteforce html form. This is a for loop that check every password from "PassList" and runs until it matches the current password by checking the redirected url. How can i implement multiprocessing here</p>

<pre><code>for x in PasswordList:          
    br.form['password'] = ''.join(x)
    print "Bruteforce in progress.. checking : ",br.form['password']
    response=br.submit()

    if response.geturl()=="http://192.168.1.106/success.html":
        #url to which the page is redirected after login
        print "\n Correct password is ",''.join(x)
        break
</code></pre>

<pre><code>from multiprocessing import Pool

def process_bruteforce(PasswordList):
    &lt;process&gt;

if __name__ == '__main__':
    pool = Pool(processes=4)              # process per core
    is_connected = pool.map(process_bruteforce, PasswordList) 
</code></pre>

<p>I would try something like that</p>

python multiprocessing mechanize-python