问题
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?
回答1:
You can use pydoc.pager for that. It's in the standard library.
from pydoc import pager
pager('hello world\n' * 100)
来源:https://stackoverflow.com/questions/37584717/how-to-write-python-script-with-man-page-like-out-put