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

optparse.Option

Prev: optparse.make_option | Up: optparse | Next: optparse.OptionConflictError
Rel: optparse.BadOptionError, optparse.check_choice, optparse.HelpFormatter, optparse.IndentedHelpFormatter
Ref: docs.python.org — optparse.Option
Tags: #public #python3 #stdlib #optparse


Import

import optparse
from optparse import Option

Signature & Overview

optparse.Option(*opts, **attrs)

Instance attributes: _short_opts : [string] _long_opts : [string]

Methods & Attributes

Usage

import optparse

opt = optparse.Option("-n", "--num", type="int", default=1)
assert opt.dest == "num" and opt.default == 1

Gotchas

REPL Inspect

from optparse import Option
help(Option)

Linked from

Related notes