来自不同位置的2个输入python多线程

时间:2019-07-18 15:35:02

标签: python multithreading

我正尝试在python中创建一个程序,该程序将从2个不同的位置获取2个输入,例如2个命令提示符

import threading
def function1():
    someinput=input("input1")
    print(someinput)

def function2():
    anotherinput=input("input2")
    print(anotherinput)

thread1 = threading.Thread(target=function1())
thread1.start()
thread2 = threading.Thread(target=function2())
thread2.start()

我希望它要求我在一个命令提示符中输入1,在另一个命令提示符中输入2,然后将输入1打印到第一个命令提示符,将输入2打印到第二个命令提示符。

0 个答案:

没有答案