开发者

Adding to an array every 1 second in python

开发者 https://www.devze.com 2023-02-07 14:59 出处:网络
Can anyone please help me to add to an array every second? thanks.开发者_如何转开发You can simply do time.sleep(secs) to create a delay in a script.

Can anyone please help me to add to an array every second? thanks.开发者_如何转开发


You can simply do time.sleep(secs) to create a delay in a script.

import time

ls = []
add = True
while add:
    ls.append(0)
    time.sleep(1)


For 10 times a second, use a float in sleep

from time import sleep
while True:
    y.append(k[3])
    sleep(0.1)
0

精彩评论

暂无评论...
验证码 换一张
取 消