when combined like thisthe try statement must have either an except or finallyand the order of its parts must be like thistry -except -else -finally where the else and finally are optionaland there may be zero or more exceptsbut there must be at least one except if an else appears reallythe try statement consists of two partsexcepts with an optional elseand/or the finally in factit' more accurate to describe the merged statement' syntactic form this way (square brackets mean optional and star means zero-or-more here)trystatements except [type [as value]]statements [except [type [as value]]statements][elsestatements[finallystatementstrystatements finallystatements format [type [value]in python format because of these rulesthe else can appear only if there is at least one exceptand it' always possible to mix except and finallyregardless of whether an else appears or not it' also possible to mix finally and elsebut only if an except appears too (though the except can omit an exception name to catch everything and run raise statementdescribed laterto reraise the current exceptionif you violate any of these ordering rulespython will raise syntax error exception before your code runs combining finally and except by nesting prior to python it is actually possible to combine finally and except clauses in try by syntactically nesting try/except in the try block of try/finally statement we'll explore this technique more fully in but the basics may help clarify the meaning of combined try--the following has the same effect as the new merged form shown at the start of this sectionnested equivalent to merged form trytrymain-action except exception handler except exception handler exception coding details