隔一秒输出一个:
import time
myd={1:'a',2:'b'}
for key,value in dict.items(myd):
print(key,value)
time.sleep(1)
隔一秒格式化输出当下时间:
import time
while True:
print(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
time.sleep(1)
#print(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))