Define a custom exception class which takes a string message as attribute.
Topic: Define a custom exception class which takes a string message as attribute.
Solution
class MyError(Exception): def __init__(self, msg): self.msg = msg
List all Python Programs