|
@@ -157,7 +157,7 @@ class Clock(object):
|
|
|
if self._hour == 24:
|
|
if self._hour == 24:
|
|
|
self._hour = 0
|
|
self._hour = 0
|
|
|
|
|
|
|
|
- def __str__(self):
|
|
|
|
|
|
|
+ def show(self):
|
|
|
"""显示时间"""
|
|
"""显示时间"""
|
|
|
return '%02d:%02d:%02d' % \
|
|
return '%02d:%02d:%02d' % \
|
|
|
(self._hour, self._minute, self._second)
|
|
(self._hour, self._minute, self._second)
|
|
@@ -166,7 +166,7 @@ class Clock(object):
|
|
|
def main():
|
|
def main():
|
|
|
clock = Clock(23, 59, 58)
|
|
clock = Clock(23, 59, 58)
|
|
|
while True:
|
|
while True:
|
|
|
- print(clock)
|
|
|
|
|
|
|
+ print(clock.show())
|
|
|
sleep(1)
|
|
sleep(1)
|
|
|
clock.run()
|
|
clock.run()
|
|
|
|
|
|