How to write python script with man-page like out-

2019-09-14 16:01发布

This question already has an answer here:

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条回答
Summer. ? 凉城
2楼-- · 2019-09-14 16:48

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

from pydoc import pager
pager('hello world\n' * 100)
查看更多
登录 后发表回答