Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to create my own exception in python

class MyException(Exception):
    pass

raise MyException("My hovercraft is full of eels")

"""With modern Python Exceptions, 
you don't need to abuse .message, or override .__str__() or .__repr__() 
or any of it. If all you want is an informative message when your 
exception is raised, do this
Comment

PREVIOUS NEXT
Code Example
Python :: python restart script 
Python :: Python make directories recursively 
Python :: strptime 
Python :: python yaml to dict 
Python :: django creating calculated fields in model 
Python :: ParserError: Error tokenizing data. C error: Expected 1 fields in line 6, saw 3 
Python :: django file upload this field is required 
Python :: how to draw a rectangle in pygame 
Python :: discord music queue python 
Python :: converting binary to octal in python 
Python :: get first line of file python 
Python :: python get list of files in directory 
Python :: how to change the background of heading in tkinter 
Python :: create age-groups in pandas 
Python :: Simple pagination wrapper for discord.py. 
Python :: sort dictionary by value python 
Python :: how to use regex in a list 
Python :: flatten nested list 
Python :: remove spaces from string python 
Python :: df.select_dtypes 
Python :: change directory in python script 
Python :: if object has property python 
Python :: cannot safely cast non-equivalent float64 to int64 
Python :: take the first in dataloader pytorch 
Python :: inline if python 
Python :: python is float 
Python :: flask validate method 
Python :: import pil pycharm 
Python :: loop through 2 items python 
Python :: jaccard distance python 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =