代码:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Build dataset')
parser.add_argument('--do_plot', action="store_true",
help='Plot the images')
args = parser.parse_args()
Run Code Online (Sandbox Code Playgroud)
错误:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Build dataset')
parser.add_argument('--do_plot', action="store_true",
help='Plot the images')
args = parser.parse_args()
Run Code Online (Sandbox Code Playgroud)
正如您所配置的那样,该--do_plot选项不带任何参数。store_truein 中的参数表示argparse该选项的存在将自动存储True在相应的变量中。
因此,为了防止出现问题,请停止传递True到--do_plot.
| 归档时间: |
|
| 查看次数: |
8095 次 |
| 最近记录: |