发布时间:2019-08-01 17:26:31编辑:auto阅读(1604)
In Python, you can use time.sleep(seconds)
to make the current executing Python program to sleep or delay a few seconds.
import time
time.sleep(1) # delays for 1 seconds
time.sleep(10) # delays for 10 seconds
time.sleep(60) # delays for 1 minute
time.sleep(3600) # delays for 1 hour
Full example.
import time
def main():
while True:
print("DateTime " + time.strftime("%c"))
time.sleep(1) # delays for 1 seconds
if __name__ == '__main__':
main()
Output
DateTime 09/22/15 18:03:42
DateTime 09/22/15 18:03:43
DateTime 09/22/15 18:03:44
DateTime 09/22/15 18:03:45
DateTime 09/22/15 18:03:46
DateTime 09/22/15 18:03:47
#...
上一篇: python读取ppt文本内容
下一篇: 使用python创建cocos2d-x项
47494
45794
36792
34323
28960
25597
24443
19611
19111
17632
5466°
6048°
5570°
5638°
6573°
5376°
5378°
5884°
5855°
7170°