ArgumentParser添加选项并解析 用户2996659896457 2024-03-22 34 阅读1分钟 args = argparse.ArgumentParser(description="Demo prog.") args.add_argument('-p', "--platform", choices=['xhs', "weibo"], type=str, help="help str, this is platform",default="weibo") # a = args.parse_args(["-p", "xhs"]) a = args.parse_args() print(a)