Skip to content

Exception

examples

56. Python Program to Catch Multiple Exceptions in One Line

Multiple exceptions as a parenthesized tuple
1
2
3
4
5
6
7
string = input()

try:
    num = int(input())
    print(string+num)
except (TypeError, ValueError) as e:
    print(e)