On this page
optparse.Values
Prev: optparse.TitledHelpFormatter | Up: optparse
Rel: optparse.BadOptionError, optparse.check_choice, optparse.HelpFormatter, optparse.IndentedHelpFormatter
Ref: docs.python.org — optparse.Values
Tags: #public #python3 #stdlib #optparse
Import
import optparse
from optparse import Values
Signature & Overview
optparse.Values(defaults=None)
optparse.Values class.
Methods & Attributes
Values.ensure_value(self, attr, value)—Values.ensure_valuemethod/property.Values.read_file(self, filename, mode='careful')—Values.read_filemethod/property.Values.read_module(self, modname, mode='careful')—Values.read_modulemethod/property.
Usage
import optparse
v = optparse.Values({"verbose": True})
assert v.verbose is True
Gotchas
- Container returned as
optsbyOptionParser.parse_args()(counterpart toargparse.Namespace).
REPL Inspect
from optparse import Values
help(Values)
Linked from
Related notes
- tuts/python3/stdlib_module/optparse/TitledHelpFormatter Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/optparse/BadOptionError Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/check_choice Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/HelpFormatter Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/IndentedHelpFormatter Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/make_option shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/Option shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionConflictError shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionContainer shared tags: #optparse, #stdlib