读源码 argparse笔记

xiaoxiao2021-02-28  53

1.import   as  , 导入模块并另命名,便于记忆。import collections as _collections 2.ArgumentParser -- The main entry point for command-line parsing. 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. ArgumentParser,命令行解析的主要接口。add_argument()方法用于通过添加位置参数和可选参数将行为构置于parser对象中,然后parse_args()方法 被激活,将命令行的参数变成带有属性的对象。

转载请注明原文地址: https://www.6miu.com/read-2620072.html

最新回复(0)