资源简介
tor-browser-linux64-7.0.1_en-US.tar.xz
代码片段和文件信息
# Author: Steven J. Bethard .
“““Command-line parsing library
This module is an optparse-inspired command-line parsing library that:
- handles both optional and positional arguments
- produces highly informative usage messages
- supports parsers that dispatch to sub-parsers
The following is a simple usage example that sums integers from the
command-line and writes the result to a file::
parser = argparse.ArgumentParser(
description=‘sum the integers at the command line‘)
parser.add_argument(
‘integers‘ metavar=‘int‘ nargs=‘+‘ type=int
help=‘an integer to be summed‘)
parser.add_argument(
‘--log‘ default=sys.stdout type=argparse.FileType(‘w‘)
help=‘the file where the sum should be written‘)
args = parser.parse_args()
args.log.write(‘%s‘ % sum(args.integers))
args.log.close()
The module contains the following public classes:
- ArgumentParser -- The main entry point for command-line parsing. As the
example above shows the add_argument() method is used to populate
the parser with actions for optional and positional arguments. Then
the parse_args() method is invoked to convert the args at the
command-line into an object with attributes.
- ArgumentError -- The exception raised by ArgumentParser objects when
there are errors with the parser‘s actions. Errors raised while
parsing the command-line are caught by ArgumentParser and emitted
as command-line messages.
- FileType -- A factory for defining types of files to be created. As the
example above shows instances of FileType are typically passed as
the type= argument of add_argument() calls.
- Action -- The base class for parser actions. Typically actions are
selected by passing strings like ‘store_true‘ or ‘append_const‘ to
the action= argument of add_argument(). However for greater
customization of ArgumentParser actions subclasses of Action may
be defined and passed as the action= argument.
- HelpFormatter RawDescriptionhelpFormatter RawTextHelpFormatter
ArgumentDefaultsHelpFormatter -- Formatter classes which
may be passed as the formatter_class= argument to the
ArgumentParser constructor. HelpFormatter is the default
RawDescriptionhelpFormatter and RawTextHelpFormatter tell the parser
not to change the formatting for help text and
ArgumentDefaultsHelpFormatter adds information about argument defaults
to the help.
All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionhelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
“““
__version__ = ‘1.2.1‘
__all__ = [
‘ArgumentParser‘
‘ArgumentError‘
‘ArgumentTypeError‘
‘FileType‘
‘H
相关资源
- 旋量代数与李群李代数[戴建生著]20
- b1eab6eefa1f2b8f05b5eb06f3d23219.rar
- vajp38.rar
- 力软敏捷开发框架专业版7.0.zip
- 21个项目玩转深度学习基于TensorFlow的
- 计算机网络.7z
- 新92daikan自动刷课答题v.2.1.zip
- 算法第四版.rar
- MyKTV.rar
- 交互原型axure50套第二版.zip
- 米波现场7.2.5.zip
- xx.tar
- Vue.js实战.pdf
- 威盾IPguard4.23.0707.0内网监控官方.z01
- 力软敏捷企业专业版(V6.1_升级版)
- 嵌入式网络那些事——STM32物联实战
- jdk-8u152-windows-x64.rar
- 新概念模拟电路4-信号处理电路.rar
- 风河Workbench3.0_VxWorks6.6应用程序开发使
- zw_internet_27.zip
- 射频电路设计实战宝典512页145.0M高清
- mathematicaanewkindofscience.pdf
- Vue.js项目实战.pdf
- 最新牛牛源码三公炸金花牌九二八杠
- 计算机视觉中的多视图几何(高清中
- 系统规划与管理师_全套资料.zip
- OpManager.zip
- 2019-11--单片机实训课程设计--clq.zip
- 啦啦外卖18.2.zip
- 计算机科学概论(第12版).pdf
评论
共有 条评论