Else & Finally In Try Except

 f1 = open("aryan.txt")


try:

    f = open("does2.txt")


except EOFError as e:

    print("Print eof error aa gaya hai", e)


except IOError as e:

    print("Print IO error aa gaya hai", e)


else:

    print("This will run only if except is not running")


finally:

    print("Run this anyway...")

        # f.close()

    f1.close()


print("Important stuff")


Comments

Popular posts from this blog

Practice Execise 3

Pickle Module