On this page
  1. inspect.cleandoc
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

inspect.cleandoc

Prev: inspect.classify_class_attrs | Up: inspect | Next: inspect.ClosureVars
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.cleandoc
Tags: #public #python3 #stdlib #inspect


Import

import inspect
from inspect import cleandoc

Signature & Overview

inspect.cleandoc(doc)

Clean up indentation from docstrings.

Usage

import inspect

raw = """Summary line.

    Indented body line.
    """
assert inspect.cleandoc(raw) == "Summary line.\n\nIndented body line."

Gotchas

REPL Inspect

from inspect import cleandoc
help(cleandoc)

Linked from

Related notes