Answer the question
In order to leave comments, you need to log in
How to initialize a variable in a child class?
class Event(object):
def __init__(self, **kwargs):
self.time = kwargs['time']
self.severity = kwargs['severity']
self.type = kwargs['type']
self.uid = kwargs['uid']
self.files = kwargs['files']
class MassStorageEvent(Event):
def __int__(self, **kwargs):
self.device = kwargs['device']
super(MassStorageEvent, self).__init__(**kwargs)
def main():
firstEvent = MassStorageEvent( time=15654687654.0,
severity=3,
type=1,
uid=222,
files='test.txt',
device='ddf29347983')
print('f')
if __name__ == '__main__':
main()
Answer the question
In order to leave comments, you need to log in
You have a typo in the MassStorageEvent constructor, missing the letter i .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question