PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Python · Theory

Multiple exceptions

← All stacks

Theory

63/268

Multiple exceptions

One except can catch several types. except (TypeError, ValueError) as e: handles both. Or write two except blocks if the recovery is different. Order matters: catch the specific type before a wide parent like Exception, or the wide one steals the case.

Tuple form vs separate except — both valid. as e gives the message. Dry-run: int("Asha") is ValueError, 1 + "a" is TypeError. Same handler can print e for both.

Multiple exceptions — output — ValueError. int("Asha") cannot convert.

Diagram
try:  10 / 0
         │ ZeroDivisionError
         ▼
  except → Cannot divide
         │
         ▼
      finally
Exam tip

Show the tuple syntax once.

Example

# Multiple exceptions
try:
    int("Asha")
except (ValueError, TypeError) as e:
    print(type(e).__name__)

Multiple exceptions — output: ValueError. int("Asha") cannot convert.

Short notes

  • DefExcept (A, B)
  • RuleOr multiple except blocks
  • RememberOrder: specific first

Questions

1

Explain Multiple exceptions as if you are teaching a junior — definition, then one tiny script.

2

What does the example print, and why?

3

What mistake do freshers make with Multiple exceptions?

Previous← Exception Handling in PythonNextraise →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.