print integer division or modulo by zero zerodivisionerror('integer division or modulo by zero',by contrastpython localizes the exception reference name to the except block-the variable is not available after the block exitsmuch like temporary loop variable in comprehension expressions ( also doesn' accept ' except comma syntaxas noted earlier) :\codepy - try except exceptionxsyntaxerrorinvalid syntax try except exception as xprint(xdivision by zero nameerrorname 'xis not defined localizes 'asnames to except block unlike compression loop variablesthoughthis variable is removed after the except block exits in it does so because it would otherwise retain reference to the runtime call stackwhich would defer garbage collection and thus retain excess memory space this removal occursthougheven if you're using the name elsewhereand is more extreme policy than that used for comprehensionsx try except exception as xprint(xdivision by zero nameerrorname 'xis not defined { for in 'spam'{' '' '' '' ' localizes _and_ removes on exit / localizes onlynot removed because of thisyou should generally use unique variable names in your try statement' except clauseseven if they are localized by scope if you do need to reference the exception instance after the try statementsimply assign it to another name that won' be automatically removedthe raise statement