Python 在for循环中每隔10秒打印一次消息
在for循环随时间运行时,每10秒打印一次消息直到完成100次睡眠的任何方法。sleepPython 在for循环中每隔10秒打印一次消息,python,python-3.x,python-2.7,Python,Python 3.x,Python 2.7,在for循环随时间运行时,每10秒打印一次消息直到完成100次睡眠的任何方法。sleep import time for i in range(100, 0, -1): time.sleep(1) if i == ?: print('hello') 我相信你需要 import time for i in range(99, 0, -1): time.sleep(1) if i % 10 == 0: print('hello'
import time
for i in range(100, 0, -1):
time.sleep(1)
if i == ?:
print('hello')
我相信你需要
import time
for i in range(99, 0, -1):
time.sleep(1)
if i % 10 == 0:
print('hello') # Print every 10 seconds
我相信你需要
import time
for i in range(99, 0, -1):
time.sleep(1)
if i % 10 == 0:
print('hello') # Print every 10 seconds
考虑重写你的问题。不清楚你想要什么。考虑重写你的问题。你想要什么还不清楚。