I wonder how to write a script with stdout like command-line like 'more', 'less', 'man' which it is seems they show their result in another layer of bash. how can I write a program with such output in python?
Asked
Active
Viewed 709 times
0
-
Do you want to rewrite `less` or do you want to show the output of your programm in `less` ? `python3 your_program.py | less` is the typical way to do it. – Julien Palard Jun 02 '16 at 06:58
-
1`less` is a class of program called a "pager" or ["terminal pager"](https://en.wikipedia.org/wiki/Terminal_pager) – Håken Lid Jun 02 '16 at 07:09
-
Best help! I did look for program class name "pager" @HåkenLid – Mohammad Reza Jun 02 '16 at 09:49
1 Answers
0
You can use pydoc.pager for that. It's in the standard library.
from pydoc import pager
pager('hello world\n' * 100)

Håken Lid
- 22,318
- 9
- 52
- 67