这是我的家庭作业。当我运行此代码时,我应该得到一个输出,如“ result [(arrivaltime:Mon Mar 9 14:10:00 2020, user:mary, session:42, event:click, usrfield:13)] ”,但我得到一个错误的输出,即“ [<main.0x0000000000522100>]“我不明白问题出在哪里。任何人都可以帮忙吗?import timeimport randomclass Log: def __init__(self, arrivaltime, user, session, event, usrfield): self.arrivaltime = arrivaltime self.user = user self.session = session self.event = event self.usrfield = usrfield def getArrivaltime(self): return self.arrivaltime def getUser(self): return self.user def getSession(self): return self.session def getEvent(self): return self.event def getUsrfield(self): return self.usrfield def _str_(self): return "(arrivaltime:%s, user:%s, session:%d, event:%s, usrfield:%d)" % (time.ctime(self.arrivaltime), self.user, self.session, self.event, self.usrfield) def _repr_(self): return "(arrivaltime:%s, user:%s, session:%d, event:%s, usrfield:%d)" % (time.ctime(self.arrivaltime), self.user, self.session, self.event, self.usrfield)
添加回答
举报
0/150
提交
取消