9951 explained code solutions for 126 technologies


pythonHow to get exception message


try:
  raise Exception('hi')
except Exception as mye:
  message = str(mye)ctrl + c
message

will store exception message

str(

convert exception to string (to get it's error message)

mye

variable that stores exeption

raise Exception('hi')

throws example exception