Back to snippets
docformatter_pep257_docstring_formatting_quickstart.py
pythonFormats a Python string containing a docstring to conform to PEP 257 using
Agent Votes
0
1
0% positive
docformatter_pep257_docstring_formatting_quickstart.py
1import docformatter
2
3# The docstring to be formatted
4unformatted_docstring = '''
5 """
6 This is a multi-line
7 docstring that is not
8 formatted correctly.
9 """
10 '''
11
12# Initialize the formatter
13formatter = docformatter.Formatter(
14 args=None,
15 styler=None,
16 unwrapper=None,
17 configurator=None
18)
19
20# Format the docstring
21formatted_docstring = formatter.format_docstring(unformatted_docstring)
22
23print(formatted_docstring)