资源简介
tor-browser-linux64-8.0.3_zh-CN.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
- 上一篇:2019美赛O奖论文
- 下一篇:冒号课堂:编程范式与OOP思想_带书签_高清完整版
相关资源
- 我和LABVIEW一个NI工程师的十年编程经
- 密码学与网络安全第3版.pdf
- 最新大厅H5牛牛棋牌源码开源稳定运营
- SwitchHosts!-win32-x64.zip
- 合并版.pdf
- PROPACK907S_V3_REV300021_富士通16位编译环
- 高等代数第3版完整高清[丘维声著]2
- 数学分析中的典型问题与方法第2版
- 大话数据结构.7z
- 美国大学生数学建模竞赛题解析与研
- 小米一键刷机工具V4.2版.exe
- hyperledger-fabric-linux-amd64-2.0.0.zip
- FlexSim6.0.2.rar
- 于博士信号完整性视频.7z.008
- WPSOffice2016专业版终身授权鸡活.rar
- torbrowser-install-win64-8.5.5_en-US.exe
- 微信小程序实战入门(内含完整解析
- jre1.8.0_111.part1.rar
- Unity3D网络游戏实战(全).pdf.zip
- 复变函数论第4版[钟玉泉编]2013年版
- 开关功率变换器开关电源的原理、仿
- 算法导论中文版_原书第3版(带目录)
- VisualBasic2015入门经典(第8版).pdf
- 《深入理解TensorFlow架构设计与实现原
- 《TensorFlow快速入门与实战》.zip
- slambook-master.tar.gz
- 2019美赛特等奖论文.zip
- 数据结构-邓俊辉-完整扫描版.pdf
- CiscoAnyConnect4.8.01090.rar
- Keil5c51v960a.rar
评论
共有 条评论