How to slow down output of a shell command using Python

How to slow down output of a shell command using Python

On Linux a command or a text file can produce a lot of output which is really difficult to read with tail or cat because speed, there are ways to make things easier with less command, but what about output that is constantly produced? like a program or a log file?

I created a small python tool that prints piped input with a delay of one line per 100ms by default.

Example how to setup the tool:$ chmod +x slowout.py
$ sudo mv slowout.py /usr/bin/slowout

Example: run with defaults$ ls -lta | slowout

This will print one line per 100ms, enough time to see text scrolling and catch details.

Example: How to define delay$ ls -lta | slowout .5

This will print one line per 500ms.