On this page
  1. argparse.RawTextHelpFormatter
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

argparse.RawTextHelpFormatter

Prev: argparse.RawDescriptionHelpFormatter | Up: argparse
Rel: argparse.Action, argparse.ArgumentDefaultsHelpFormatter, argparse.ArgumentError, argparse.ArgumentParser
Ref: docs.python.org — argparse.RawTextHelpFormatter
Tags: #public #python3 #stdlib #argparse


Import

import argparse
from argparse import RawTextHelpFormatter

Signature & Overview

argparse.RawTextHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None, color=True)

Help message formatter which retains formatting of all help text.

Methods & Attributes

Usage

import argparse

p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
p.add_argument("--mode", help="fast: skip checks\nsafe: full validation")
assert "fast: skip checks\n" in p.format_help()

Gotchas

REPL Inspect

from argparse import RawTextHelpFormatter
help(RawTextHelpFormatter)

Linked from

Related notes