我想在python shell中编写简单的数字时钟.我想尽可能避免使用tkinter.这就是我现在拥有的;
import time
while True:
from datetime import datetime
now = datetime.now()
print ("%s/%s/%s %s:%s:%s" % (now.month,now.day,now.year,now.hour,now.minute,now.second))
time.sleep(1)
Run Code Online (Sandbox Code Playgroud)
这会产生反复出现的打印,就像这样;
06/29/16 23:08:32
06/29/16 23:08:33
06/29/16 23:08:34
Run Code Online (Sandbox Code Playgroud)
我知道这很粗糙,我还在学习.我只想要在shell中使用"滴答"数字时钟的一行.我在空闲和Windows 10上使用python 3.5.1.
如果这是不可能的,我非常想知道原因.
非常感谢