0

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?

3
  • 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. Commented Jun 2, 2016 at 6:58
  • 1
    less is a class of program called a "pager" or "terminal pager" Commented Jun 2, 2016 at 7:09
  • Best help! I did look for program class name "pager" @HåkenLid Commented Jun 2, 2016 at 9:49

1 Answer 1

0

You can use pydoc.pager for that. It's in the standard library.

from pydoc import pager
pager('hello world\n' * 100)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.