How to create a scrollable screen in text mode with Python

后端 未结 3 710
清酒与你
清酒与你 2021-01-03 02:19

I would like to create a scrollable screen in text mode, like the one obtained when typing help(object) in the interpreter. Is there a cross-platform module I can use to eas

相关标签:
3条回答
  • 2021-01-03 02:46
    from pydoc import ttypager
    
    def jhelp(object):
         text = # get text for object
         ttypager(text) # display a scrollable screen.
    
    0 讨论(0)
  • 2021-01-03 02:47

    look at pydoc module in the standard library

    0 讨论(0)
  • 2021-01-03 03:04

    I think what you really want is from pydoc import pager. ttypager is a very reduced pager, but pager will automatically use a better pager (basically less) if it is available.

    0 讨论(0)
提交回复
热议问题