time de uma thread

 avatar
unknown
python
2 years ago
379 B
11
Indexable
from threading import Thread
import time

dic = {'time': 0}


def temporizador():
    count = 0
    while True:
        count += 1
        dic.update({'time': count})
        time.sleep(1)

Thread(target=temporizador).start()

def contador():
    n = 0
    while True:
        t = dic['time'] #puxa time do dic
        if t > n:
            n = t
            print(t)

contador()
Editor is loading...