如何编写带有外认沽手册页python脚本 [英] How to write python script with man-page like out-put

查看:110
本文介绍了如何编写带有外认沽手册页python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何写像命令行状多,少,人,这是似乎标准输出脚本,他们展示自己在bash的另一层结果。
我怎么能写在巨蟒这种输出的程序?

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?

推荐答案

您可以使用pydoc.pager了点。这是在标准库。

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

from pydoc import pager
pager('hello world\n' * 100)

这篇关于如何编写带有外认沽手册页python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆