indent¶
-
odl.util.utility.
indent
(string, indent_str=' ')[source]¶ Return a copy of
string
indented byindent_str
.- Parameters
- stringstr
Text that should be indented.
- indent_strstr, optional
String to be inserted before each new line. The default is to indent by 4 spaces.
- Returns
- indentedstr
The indented text.
Examples
>>> text = '''This is line 1. ... Next line. ... And another one.''' >>> print(text) This is line 1. Next line. And another one. >>> print(indent(text)) This is line 1. Next line. And another one.
Indenting by random stuff:
>>> print(indent(text, indent_str='<->')) <->This is line 1. <->Next line. <->And another one.