Back
try: something hereexcept: print 'the whatever error occurred.'
try:
something here
except:
print 'the whatever error occurred.'
How can I print the error/exception in my except: block?
You can print an exception like this:
try: something hereexcept Exception as e: print(e)
except Exception as e:
print(e)
To print an exception in Python you can use below-mentioned code:-
except Exception as e: print(e)
31k questions
32.8k answers
501 comments
693 users