I would like to extract only commented data from python program.
def addlist():
'''
method to add all the number in a list
:return:integer
'''
input_number = [1, 2, 3, 4, 5]
sum = reduce(lambda x, y: x + y, input_number, 10)
print("sum is:", sum)
return sum
I was trying some regex but could not do it successfully. I want to get
'method to add all the number in a list:return:integer'
Any help is appreciated
__doc__method, or you can use a tool such as pydoc that will extract those strings as documentation, and then you can template the documentation for whatever you want to present it.