How do I export the output of Python's built-in help() function

前端 未结 9 1083
时光取名叫无心
时光取名叫无心 2020-12-15 20:19

I\'ve got a python package which outputs considerable help text from: help(package)

I would like to export this help text to a file, in the format in w

9条回答
  •  情深已故
    2020-12-15 20:26

    If you do help(help) you'll see:

    Help on _Helper in module site object:
    
    class _Helper(__builtin__.object)
     |  Define the builtin 'help'.
     |  This is a wrapper around pydoc.help (with a twist).
    

    [rest snipped]

    So - you should be looking at the pydoc module - there's going to be a method or methods that return what help(something) does as a string...

提交回复
热议问题