import os
from _thread import start_new_thread
iList = ["Hello", "World"]
def func(p):
while True:
print("\n".join(iList))
os.system("CLS")
start_new_thread(func, ("Placeholder",))
while True:
iList.append(input("Write Something: "))
我希望iList
能够实时更新,而不会破坏用户已经键入的内容,尽管它不会删除用户已经在input
中键入的内容,但它表明它确实删除了
控制台不是那样工作的。在Unix下,您会使用^{} module ,但是(由于您使用了
CLS
),我认为您是在Windows下,因此这没有多大帮助。curses HOWTO包含了一个Windows替代方案的建议,以及如何处理用户输入的示例相关问题 更多 >
编程相关推荐