import time
def show_time():while True:t = time.localtime()s = '\r %02d : %02d : %02d' % (t[3], t[4], t[5])print(s, end=' ')time.sleep(1)
show_time()
我用MAC OS13,使用自带的Terminal,Python3.8版本尝试运行你上面的代码,是可以达到你的预期效果的,不换行的时钟按秒变化显示。3.7的版本目前电脑上没有,没有试过。