exception handling – Python FileNotFound

exception handling – Python FileNotFound

try block should be around open. Not around prompt.

while True:
    prompt = input(n Hello to Sudoku valitator,
    n n Please type in the path to your file and press Enter: )
    try:
        sudoku = open(prompt, r).readlines()
    except FileNotFoundError:
        print(Wrong file or file path)
    else:
        break

exception handling – Python FileNotFound

Leave a Reply

Your email address will not be published. Required fields are marked *