mardi 2 janvier 2018

While loop don't work into the for bucle

    mi_path = r"F:\releases\"
    validate = False
    for dirs,paths,files in os.walk(mi_path):   
        while validate == False:
            if str(release_buscar) in str(dirs):
                print("Release encontrada "+dirs)
                break
            else:
                print("Release no encontrada")
                release_buscar =  input("Introduce el nombre otra vez:")
                validate = False
    print("Final del bucle")

Hello. I need find a folder in the dir input selected from by the user. I want validate if the folder really exist, if it isn't there then ask for the name of folder again to the user.

The problem if what never find the folder, always jump to the else:. some idea ? thanks.

Aucun commentaire:

Enregistrer un commentaire