File: class/Workbook/Examples/Lecture8/mybad.py

class MyBad:
    def __init__(self, file, line):
        self.file = file
        self.line = line
    def display(self):
        print self.file * 2

def parser():
    raise MyBad('spam.txt', 5)

try:
    parser()
except MyBad, X:
    print X.file, X.line
    X.display()



[Home page] Books Code Blog Python Author Train Find ©M.Lutz