A
A
AlexGenesis2021-04-30 13:01:08
Python
AlexGenesis, 2021-04-30 13:01:08

How to not wait for user input in python?

Hello, I have the following code:

def some_func():
    while True:
        Name = str(input("Какойто текст:"))
        print("OK")

some_func()


The question is how to make it so that the program does not stop at the line with input, but scrolls the while loop further and displays "OK" in the console, regardless of whether the user has entered something or not.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Grandma Luda, 2021-04-30
@KirasiH

Granddaughter, use the threading library

A
alexbprofit, 2021-04-30
@alexbprofit

async def some_func():
    while True:

        print("OK")
        await str(input("Какойто текст:"))

some_func()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question