有没有办法在 python 输入后已经输入文本?

Is there a way to have already typed text after the input in python?

提问人:Korogue 提问时间:5/18/2023 更新时间:5/18/2023 访问量:40

问:

我想创建一个程序,以便我可以向用户提出问题,并且响应区域内会出现一些文本。此文本应可由用户删除。

通常,当你在 Python 中使用 input(“text”) 时,它只要求用户做出响应。我真的没想到有什么不同。

python-3.x 输入

评论

0赞 TheTridentGuy supports Ukraine 5/18/2023
python 内置的 curses 模块可以提供帮助吗:docs.python.org/3/howto/curses.html

答:

3赞 Gabriel Ben Compte 5/18/2023 #1

你可以使用 pyautogui 来做到这一点。

from pyautogui import typewrite

print("How are you?")
typewrite("Bad")
folder = input()

这将导致文本“你好吗”打印且不可编辑,文本“Bad”打印但可编辑。