I want to extract all docstrings from my python file using grep or awk. I tried
cat test.py | grep """[\w\W]*?"""
But I see no output.
Say the the test test.py looks like this.
import libraries
class MyClass(object):
"""Docstring to this class.
second line of docstring."""
def myClassMethod(a,b):
"""Docstring of the method.
another line in docstring of the method."""
return a + b
Then the output should be all that is enclosed in triple quotes.
"""Docstring to this class.
second line of docstring."""
"""Docstring of the method.
another line in docstring of the method."""