I am new to Python app development. I know about the Python exceptions, but when I use the except
keyword it shows me SyntaxError
. My code is
number = 1
try:
if(number == 1):
except ValueError:
print "yay"
else:
print "sucks"
When I use this code it gives me a syntax error when I add the except
keyword. Since I'm new to Python I don't know why it's happening like this. I'm using Python 2.7.