You are viewing an older version (9.5.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.5.0 / IPython / utils / text / indent

function

IPython.utils.text:indent

source: /IPython/utils/text.py :264

Signature

def   indent ( instr : str nspaces : int = 4 ntabs : int = 0 flatten : bool = False )  →  str

Summary

Indent a string a given number of spaces or tabstops.

Extended Summary

indent(str, nspaces=4, ntabs=0) -> indent str by ntabs+nspaces.

Parameters

instr : basestring

The string to be indented.

nspaces : int (default: 4)

The number of spaces to be indented.

ntabs : int (default: 0)

The number of tabs to be indented.

flatten : bool (default: False)

Whether to scrub existing indentation. If True, all lines will be aligned to the same indentation. If False, existing indentation will be strictly increased.

Returns

str : string indented by ntabs and nspaces.

Aliases

  • IPython.core.oinspect.indent