Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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?
less
python3 your_program.py | less
You can use pydoc.pager for that. It's in the standard library.
from pydoc import pager pager('hello world\n' * 100)
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
lessor do you want to show the output of your programm inless?python3 your_program.py | lessis the typical way to do it.lessis a class of program called a "pager" or "terminal pager"