I have a try/except code block that I want to modify with and if/else statement that will execute parts of the code and skip over others.
This is the logic stub I have right now:
if arg1 == 'None':
do something
else:
do something else
try:
execute main code
except:
update failed status
execute_seperate_function(arg)
What I want to do is if the code goes into the first if statement, then run the try/except and the last function as is. However, if it goes into the else statement I would like to run the try code as is, but skip executing the except and last function.
Is there a good way to do this instead of putting everything inside if/else statements and make the code really messy? Any help is appreciated!
Aucun commentaire:
Enregistrer un commentaire