trying to get my try except block to work.
import sys
def main():
try:
test = int("hello")
except ValueError:
print("test")
raise
main()
output is
C:\Python33>python.exe test.py
test
Traceback (most recent call last):
File "test.py", line 10, in <module>
main()
File "test.py", line 5, in main
test = int("hello")
ValueError: invalid literal for int() with base 10: 'hello'
C:\Python33>
would like the except to trip
raise. The first sentence states:If no expressions are present, raise re-raises the last exception that was active in the current scope.