0
Can't we use both finally and raise in the same block of code?
I'm unable to use both finally and raise at a time E.g: try: print(2/0) except: pass raise ZeroDivisionError finally: print('last word') For this I'm facing Syntax Error.
2 Answers
+ 4
raise ZeroDivisionError is not indented.
That means that the try-block is already over.
So your finally has no relation to anything, because it finds no try-block before it.
0
What are you trying to achieve?