Python FTP login and relogin with other data in one wash?

I have a short part of the script like this, which scrans ftp ips from a list and login with the data specified.

login1
pssword1

is it possible to try sevral login data without starting the script again with modified login data?

somehow like:
if (login1 pw1 or login2 pw2 or login3 pw3)
{
print "unsafe"
}

                    try:
                        ftp = ftplib.FTP(ip_add)
                        ftp.login('login1', 'password1') 
                    except ftplib.all_errors:
                        print 'OK: %s' % (ip_add)
                    else:
                        print 'Unsafe PW: %s' % (ip_add)
                        write = open('Ftp.txt', "a+")
                        write.write(ip_add + '\n')
                        write.close()  
                        ftp.quit()