i have an curious Question regarding except Block, especially finally:
During the first Block of Code finally works as it is supposed to work, meanwhile in second which is minimaly different from the first one it always gives you an error.
First:
def askint():
while True:
try:
val = int(raw_input("Please enter an integer: "))
except:
print "Looks like you did not enter an integer!"
continue
else:
print 'Yep thats an integer!'
break
finally:
print "Finally, I executed!"
print val
Second:
def Abra():
while True:
try:
v = int(raw_input('Geben Sie bitte einen Integer ein (1-9) : '))
except :
print 'Einen Integer bitte (1-9)'
continue
if v not in range(1,10):
print ' Einen Integer von 1-9'
continue
else:
print 'Gut gemacht'
break
finally:
print "Finally, I executed!"
Abra()
Open for all solutions - Thanks