我应该如何在终端中向 pyperclip 运行 提供输入?

How am i supposed to give input to pyperclip running in terminal?

我正在阅读使用 python 自动化无聊的东西,当我在 运行 终端中的程序时,它不会提示输入。我想提供多行作为输入。我该怎么做?

本书中的示例希望您在 运行 程序时提供输入,

python foo.py username password

如果您想在 运行 时收到提示,请在您的脚本中使用如下内容,

username = input("enter your username")
password = input("enter your password")

然后使用pyperclip复制

pyperclip.copy(username)