Catch exception with message?

Peter Pearson pkpearson at nowhere.invalid
Sat Jun 4 12:44:04 EDT 2016


On Sat, 4 Jun 2016 04:44:30 +0530, Piyush Verma <114piyush at gmail.com> wrote:
> Generally we catch exception using
> except Exception as e:
>
> But sometimes, we see same type of exception is present with different
> message.Is there a way to capture same exception with message
> filtering? Please help me to do this.

Just to make sure, . . . are you aware that "except Exception" is
generally not what you want to do, that you generally want to say
"except ValueError" or "except KeyError" or "except UnicdeDecodeError"
or something specific like that?  Maybe that's where to find the
specificity you seek.

-- 
To email me, substitute nowhere->runbox, invalid->com.


More information about the Python-list mailing list