Input via STDIN

STDIN is sent to a process directly by using a command’s _in special kwarg:


Any command that takes input from STDIN can be used this way:

print(tr("[:lower:]", "[:upper:]", _in="sh is awesome"))

You’re also not limited to using just strings. You may use a file object, a queue.Queue, or any iterable (list, set, dictionary, etc):

stdin = ["sh", "is", "awesome"]
out = tr("[:lower:]", "[:upper:]", _in=stdin)


If you use a queue, you can signal the end of the queue (EOF) with None