pythonもプライベートカスタマイズをします.小さなタイマー
1646 ワード
import time as t
class Time():
def __str__(self):
return self.prompt
__repr__ = __str__
def __iadd__(self, other):
tips=' '
result = []
print(other.lasted)
print(self.lasted)
for index in range(6):
result.append(self.lasted[index] + other.lasted[index])
print(index)
if result[index]:
tips +=(str(result[index])+self.un[index])
return tips
#
def __init__(self):
self.begin = 0
self.end = 0
self.lasted = []
self.prompt = ' 。 start ?'
self.un=[' ',' ',' ',' ',' ',' ']
#
def start(self):
self.gegin = t.localtime()
print(' ')
#
def stop(self):
self.end = t.localtime()
if self.begin == 0:
print(' start() !!!')
else:
self.calc()
print(' ')#
def calc(self):
self.prompt = ' '
lasted = []
for index in range(6) :
lasted.append(self.end[index]-self.begin[index])
if lasted[index]:
self.prompt += (str(lasted[index]) + self.un[index])
print(list(lasted))
self.begin=0
self.end=0