Код: Выделить всё
import time
import threading
def printer():
while True:
print("Message")
time.sleep(30)
def getter():
while True:
text = str(input())
if text == "sample_text":
print("It's sample text")
thread1 = threading.Thread(target=printer)
thread1.start()
thread2 = threading.Thread(target=getter)
thread2.start()
Подробнее здесь: https://stackoverflow.com/questions/791 ... 1-function
Мобильная версия