Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在阅读用 python 自动化无聊的东西,当我在终端中运行程序时,它不会提示输入。我想提供多行作为输入。我怎样才能做到这一点?
书中的示例希望您在运行程序时提供输入,例如,
python foo.py username password
如果您想在运行时收到提示,请在脚本中使用类似下面的内容,
username = input("enter your username") password = input("enter your password")
然后使用 pyperclip 复制
pyperclip.copy(username)