python - syntax error when use except keyword -



python - syntax error when use except keyword -

i new python app development. know python exceptions, when utilize except keyword shows me syntaxerror. code is

number = 1 try: if(number == 1): except valueerror: print "yay" else: print "sucks"

when utilize code gives me syntax error when add together except keyword. since i'm new python don't know why it's happening this. i'm using python 2.7.

number = 1 try: if(number == 1): print 'yay' else: print 'sucks' except valueerror: print 'oops, went wrong'

follow construction , golden pony boy.

python

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -