N
N
NOblo2020-06-05 22:46:40
Python
NOblo, 2020-06-05 22:46:40

How to continue to execute if there is an infinite loop?

a = 0
while True:
    a = a+1
#код ниже не будет выполняться
b = Input("?")


^
Here, I want variable a to always grow.
Or nuzheo to do through other text files with open?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iris_wolf, 2020-06-06
@NOblo

(replace dots with spaces)
Use threads i.e.
import threading
a = 0
def foo():
....while True:
........ a += 1
if __name__ == "__main__":
... .threading.Thread(target=foo, args=(), daemon=False)
....# Your code
....b = Input("?")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question