创建新行后我可以继续输入吗

Can I continue an input after a new line is created

我想在终端中创建新行后继续输入。

这是我写的快速脚本:

import threading, time

def inn():
    while True:
        input()

def count():
    a=0
    while True:
        a+=1
        print(a)
        time.sleep(1)

t1 = threading.Thread(target=inn)
t2 = threading.Thread(target=count)

t1.start()
t2.start()

我有什么办法可以做到这一点,最好是使用内置函数。

如果您将代码更改为:

.
def inn(): # in is restricted name in python
    while True:
        print(input())
.
.
.

你会发现你的代码已经做了你想要的!虽然看起来不像,但输入没有中断,看看程序:

1
2
t3
his 4
iss 5
my 6
strin7
g 8

this iss my string 
9

您的代码唯一需要更改的是更改受限名称 in