finalizar input

 avatar
unknown
python
3 years ago
387 B
11
Indexable
import threading
import time
import os

string = ''

def contador():
    tempo_maximo = 5 # segundos
    start = time.time()
    while True:
        if int(time.time() - start) > tempo_maximo and not string:
            print('\ndemorou demais!')
            os._exit(0)
        elif string:
            break


t = threading.Thread(target=contador)
t.start()
string += input("digite :")
Editor is loading...