Skip to content Skip to sidebar Skip to footer

Pydoc.render_doc() Adds Characters - How To Avoid That?

There are already some questions touching this but no one seems to actually solve it. import pydoc hlpTxt = pydoc.render_doc(help) already does what I want! looks flawless when pr

Solution 1:

In python 2, you can remove the boldface sequences with pydoc.plain:

pydoc.plain(pydoc.render_doc(help))

 

>>> help(pydoc.plain)
Help onfunction plain inmodule pydoc:

plain(text)
    Remove boldface formatting fromtext.

 

In python 3 pydoc.render_doc accepts a renderer:

pydoc.render_doc(help, renderer=pydoc.plaintext)

 

Post a Comment for "Pydoc.render_doc() Adds Characters - How To Avoid That?"