import time
def findcurrentTime():
currentTime = time.time()
totalSeconds = int(currentTime)
currentSecond = totalSeconds`
totalMinutes = totalSeconds//60
currentMinute = totalMinutes`
totalHours = totalMinutes//60
currentHour = totalHours$
timebox = [currentSecond, currentMinute, currentHour]
return timebox
class myTime():
def __init__(self):
nowtime = findcurrentTime()
self.__hour =nowtime[2]
self.__minute = nowtime[1]
self.__second = nowtime[0]
------------------------------------------------
보시면 알겠지만 현재시간을 반환하는 함수를 만들고 세 개의 값을 한번에 리턴하려고
리스트 만들어서 집어넣었습니다.
그리고 이거를 클래스에서 불러오는 변수를 만들고 여기에 함수를 집어넣었구여
private 변수들에 현재 시,분,초를 집어넣는데
프린트하면 아래처럼 떠요 ㅠㅠ
해결방법좀 가르쳐주세요 ㅠㅠ
<bound method Time.getHour of <__main__.Time object at 0x000001E497A734E0>> 시
<bound method Time.getMinute of <__main__.Time object at 0x000001E497A734E0>> 분
<bound method Time.getSecond of <__main__.Time object at 0x000001E497A734E0>> 초
댓글 0