try catch - Python trying fails -


i trying in python.

try:     newbutton['roundcornerradius'] = buttondata['roundcornerradius']  buttons.append(newbutton) 

buttons list. roundcornerradius optional in buttondata.

alas gives

buttons.append(newbutton)       ^ syntaxerror: invalid syntax 

i want ignore cases roundcornerradius not exist. don't need error reported.

why arent using except keyword

try:     newbutton['roundcornerradius'] = buttondata['roundcornerradius']     buttons.append(newbutton) except:     pass 

this try first part , if error thrown except part

you can add disered error want except error this

except attributeerror:

you can excepted error doing this:

except exception,e: print str(e)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -