import sysdict = {}dict[ValueError] = "Enter a valid value"dict[IOError] = "An error occurred in the IO system"try : raise ValueErrorexcept : if dict.has_key(sys.exc_type) : print dict[sys.exc_type]