python - Put a list to 0 each 30 seconds -
i created list filled zeros, writting ones in cases of list goal put list 0 every 30 seconds , don't know how (i newbie in python).
i found parts of code on internet , assembled them. reading sip prints, when received "sip/2.0 200 ok", means terminal active , put 'one' in case 25 if it's ip adress 192.168.1.25. mobile can not registered after being registered few times ago, put list 0 every 30 seconds.
to @ given interval of time, can use timing functions.
import time time.sleep(30)
will pause execution of code 30 seconds. note blocking, cannot during time (at least not in same thread, , multithreading/multiprocessing things ge lot more difficult). put 0 list (in case is, want do) 30 seconds do:
import time list_of_values = [] while true: time.sleep(30) list_of_values.append(0)
wiki
Comments
Post a Comment