python – Continue code execution if there is no input in input ()


input() pauses code execution while waiting for user input. Is there a way to skip this line if input() hasn't received any input within X seconds?


import multiprocessing.pool

def input_timeout(text: str, timeout: int):
    return multiprocessing.pool.ThreadPool().apply_async(input, [text]).get(timeout)
Scroll to Top