Argparse“ArgumentError: argument -h/--help: conflicting option string(s): -h, --help”

前端 未结 2 1293
情歌与酒
情歌与酒 2021-02-05 00:29

Recently, I am learning argparse module, Argument error occurred below the code

import argparse
import sys


class ExecuteShell(object):
    def create(self, arg         


        
2条回答
  •  梦谈多话
    2021-02-05 00:49

    The same error pop-ups in 2 other scenarios:

    1) Repeated code

    parser.add_argument('-h',
                            '--help',
                            action='store_true',
                            help=argparse.SUPPRESS)
    
    parser.add_argument('-h',
                            '--help',
                            action='store_true',
                            help=argparse.SUPPRESS)
    

    2) When you execute the code multiple times on the same kernel

    I'm leaving it just in case if someone had simillar problem.

提交回复
热议问题