I'm trying to make a simple timer that after the time restarts the whole body of code but list can't be used as value, is there any other alternative?
randomlist = random.sample(range(200, 330),1)
time.sleep(x)
did you mean to so something like this:
from time import sleep
from random import uniform
# sleep something between 2 and 5 seconds
sleep(uniform(2, 5))
time.sleep
accepts a single float
as number of seconds to sleep;random.uniform
provides just that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.