Exception and finally question

Benjamin Hartshorne ben at hal.rescomp.berkeley.edu
Thu Apr 24 19:18:57 EDT 2003


Tung Wai Yip <tungwaiyip at yahoo.com> wrote:
> Hello,

> How to I access the exception object in a handler?

> try:
>     raise NameError, 'HiThere'
> except NameError:
>     #how to print the message 'Hi There' here?

try:
  raise NameError, "HiThere'
except NameError, whoshere:
  print whoshere, "how are you?"

-ben

-- 


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Hartshorne




More information about the Python-list mailing list