samedi 23 juillet 2016

Restart a function in python

My code is in a while True loop. It basically tries something like captcha.

So what I want is something like this

def  loop():
    toplam = 0
    global sayilar
    x = br.open(something)
    html = x.read()
    sayilar = map(str.strip,''.join(kod.findall(html)).split("\xc4\x84\xc5\x95\xc5\xa3\xc4\xb1"))
    print sayilar
    for i in sayilar:
        if i in diction:
            toplam += diction[i]
        else 
            #break the function








if __name__ == "__main__":
    giris()
    while 1:
        loop()

it can't find the number in dictionary it will break the function and restart the function again because function is in while loop.

Aucun commentaire:

Enregistrer un commentaire