'Better way to write nested if blocks

I'm trying to figure out a way to extract specific data from a text file. I have indexed them and can retrieve each value without any problems. I'm trying to modify it though so it shows an error message if the user inputs a word that isn't found in the file's contents.

Is there a better way to write this? I have taken it in and out of various indentations but cannot seem to make them appear on its own or at all. The previous configuration I tried worked but it shows immediately after "Retrieval complete".

def dbretrieve():
    dbFile = open ("dbFile.txt", "r")
    choice = input("Which URL or resource would you like the credentials for?\n")
    for line in dbFile.readlines():  
        if choice.lower() in line.lower():
            dbsplit = line.split(" | ")
            print("\n    "+dbsplit[0])
            print("    "+dbsplit[1])
            print("    "+dbsplit[2])
            print("Retrieval complete!")
            if choice.lower() in dbsplit[2].lower() is False:
                print("\nSorry, the word "+"'"+choice+"'"+" is not found in the database.")     
    dbFile.close()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source