How to write python script with man-page like out-put [duplicate]

混江龙づ霸主 提交于 2019-12-25 07:29:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!