当前位置:网站首页>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()边栏推荐
- 弹性盒子flex属性
- @Autowired与@Resource区别
- @Autowired详解[email protected]在static属性上的使用
- ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- 【遥控器开发基础教程1】疯壳·开源编队无人机-GPIO(遥控器指示灯控制)
- Redis的集群模式
- MySQL删除表数据 MySQL清空表命令 3种方法
- 基于libmodbus库实现modbus TCP/RTU通信
- (forwarded) HashCode summary (2)
- 源码构建LAMP环境-1
猜你喜欢
随机推荐
MySQL占用CPU过高,排查原因及解决的多种方式法
我的两周年创作纪念日
Monaco Editor 的基本用法
磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
SSM整合
删库后!除了跑路还能干什么?
bgp机房的动态路由和静态路由的区别
化学试剂磷脂-聚乙二醇-羟基,DSPE-PEG-OH,DSPE-PEG-Hydroxyl,MW:5000
MySql创建数据表
HCIP-第十一天-MPLS+BGP
MySQL中JOIN的用法
MySQL分组后排序
mysql中exists的用法详解
线性代数学习笔记3-1:矩阵与线性变换、常见矩阵(逆矩阵、伴随矩阵、正交矩阵等)
RHCSA第三天
弹性盒子flex属性
[详解C语言]一文带你玩转C语言小游戏---扫雷
第七周复习
MySQL中字符串比较大小(日期字符串比较问题)
@Autowired详解[email protected]在static属性上的使用









