当前位置:网站首页>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()
边栏推荐
猜你喜欢
Daily practice------There are n integers, so that the previous numbers are moved back m positions in order, and the last m numbers become the first m numbers
磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
PowerManagerService灭屏超时流程
(forwarded) HashCode summary (2)
@Accessors 注解详解
UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the index ing argu
HCIP-第十一天-MPLS+BGP
离线数仓-用户行为采集
LeetCode:746. 使用最小花费爬楼梯【动态规划】
(Reposted) The relationship between hashcode and equals
随机推荐
离线数仓-用户行为采集
Flexbox flex property
RHCSA第三天
化学试剂磷脂-聚乙二醇-羟基,DSPE-PEG-OH,DSPE-PEG-Hydroxyl,MW:5000
mysql中如何查看表是否被锁
APK的安装过程分析 PMS包管理器
@Autowired与@Resource区别
PCL—点云数据分割
【遥控器开发基础教程1】疯壳·开源编队无人机-GPIO(遥控器指示灯控制)
【遥控器开发基础教程3】疯壳·开源编队无人机-ADC(摇杆控制)
mysql创建表
MySQL分库分表
磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
【深度学习】从LeNet-5识别手写数字入门深度学习
SOCKS5
一个资深测试工程师面试一来就问我这些题目
DAY-1 | 求两个正整数的最大公约数与最小公倍数之和——辗转相除法
MySql创建数据表
AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/yolov5-5.0/models/commo
ModuleNotFoundError No module named ‘xxx‘可能的解决方案大全