Extract docstring from a function as a single-line string
I want to extract a docstring from every function in a Python module. I thought, help does the intended action, but it would print out a lot of extra stuff which I do not need. I have tried <function_name>.__doc__ as well. However, even that does print out a lot of stuff and also prints \n and \t. e.g. 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 m
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.