sys.exc_info() into string

Peter Hansen peter at
Mon Jun 24 11:19:00 EDT 2002

Magnus wrote:
> Peter Hansen wrote:
> > try:
> >     1/0
> > except Exception, ex:
> >     print "Error: %s" % ex
> >
> > Good enough??
> Thanks both of you. I'm still learning Python and issues that are trivial to
> solve for some isn't trivial for me yet. I'm converting from C++ and Java
> and perhaps in a few months I might be a more experienced Python
> programmer.

Hi Magnus, don't think just because our replies are sometimes very
concise that we think the solutions are trivial.  I remember having
to go through the same learning curve as you (short and fun though it
is with Python) and not knowing how to do the above.  

This newsgroup operates by throwing a dozen small answers at people,
and the odd monster response by one of the bots.  Usually, but not
always, we try to teach you how to catch fish rather than just handing
you the bowl of chowder.

Welcome to Python. :)


More information about the Python-list mailing list