当前位置:网站首页>parser = argparse.ArgumentParser() parsing
parser = argparse.ArgumentParser() parsing
2022-08-02 03:32:00 【woshicaiji12138】
argument module is mainly used by the user to write a command line interface; the program defines the arguments it needs, and then argument parses the arguments from sys.argv.
1. Use the process
1 to create a parser
parser = argparse.ArgumentParser()
2 parameter settings
parser.add_argument(name or flags...span>[, action][, nargs][span>, const][, default][,span> type][, choices][, required][, help][, metavar][, dest])
name or flags: Name or list.
action: The action to use when the argument appears on the command line.
nargs: the number of command-line arguments that should be read
const: the default value when no arguments are specified
default: the path
type: the type
choices: an alternative to the allowable values of the parameterA container
required: whether optional parameters can be omitted
help: help information for parameters
3 parsing parameters
opt = parser.parse_args()
边栏推荐
- ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- Flexbox flex property
- Small program (necessary common sense for development) 1
- JVM学习----垃圾回收--G1
- 源码构建LAMP环境-1
- (Repost) HashCode Summary (1)
- PCL—点云数据分割
- Redis笔记进阶篇:万字长文-整理Redis,各种知识点,建议收藏
- (forwarded) HashCode summary (2)
- STL entry basics map and set containers
猜你喜欢
随机推荐
2022.7.30 js notes Operators and flow controllers, loops
基于libmodbus库实现modbus TCP/RTU通信
(forwarded) HashCode summary (2)
线性代数学习笔记2-2:向量空间、子空间、最大无关组、基、秩与空间维数
subprocess.CalledProcessError: Command ‘pip install ‘thop‘‘ returned non-zero exit status 1.
5. Hezhou Air32F103_LCD_key
HCIP-第十天-BGP综合实验
About cross-domain issues
云服务器安装部署Nacos2.0.4版本
oracle内连接和外连接
MySQL占用CPU过高,排查原因及解决的多种方式法
线性代数学习笔记2-1:向量和向量组、线性相关性(张成空间的概念)
Good Key, Bad Key (thinking, temporary exchange, classic method)
基于优化的多核局部费舍尔判别分析的故障分类
Redis简单学习笔记
day11--shell脚本
ModuleNotFoundError No module named ‘xxx‘可能的解决方案大全
(Repost) HashCode Summary (1)
MySQL中的各种锁(行锁、间隙锁、临键锁等等LBCC)
MySQL中字符串比较大小(日期字符串比较问题)