I have a small amount of code in which I am trying to check a hash against a hash list, and return a match or no match. Right now the code below is checking and printing each line (after using tkinter to select the hash file). How can I reduce this to a single output for the user?
Example of output (with two hash examples in the test file):
HASH FOUND IN DATABASE!
Hash not found
I only want ONE result to be displayed, either hash found, or no hash found.
    user_hash = raw_input('What is the hash you would like to check?: ')
    toplevel = Tk()
    toplevel.withdraw()
    filename = tkFileDialog.askopenfilename()        
    with open(filename) as f:
        found=False
        for line in f:
            if user_hash in line:       
                print('HASH FOUND IN DATABASE!')
            else:
                print('Hash not found')
 
    