on-internet
← Community

Extract docstring from a python function

Stack Overflow ·

I want to extract a docstring from every function in a python module. Thought, help does the intended action, It would print out a lot of extra stuff which I do not need. I have tried .__ doc__ as well. However, Even that does print out a lot of stuff and also print \n and \t. eg. def Foo(): """ This is a multiline comment """ pass: I want something which will give me only the comment as a single line or in the specified format as is. >>> print (some operation on foo) >>> "This is a multiline comment" >>> How do I remove of all the extra stuff. Greater picture: I have a module with a search fu

Comments

Sign in or sign up to comment and upvote.

No comments yet.