argparse.ArgumentParser()讲解
argparse.ArgumentParser()是参数的容器,写参数时--命名规定,在调用参数是需要去掉--。
parser = argparse.ArgumentParser()
parser.add_argument('--prepared-train-labels', type=str,default=r'../../untitled/scripts/prepared_train_annotation.pkl',
help='path to the file with prepared annotations')
args = parser.parse_args()
print(args.prepared_train_labels)
输出结果
../../untitled/scripts/prepared_train_annotation.pkl

浙公网安备 33010602011771号