def extract_args ( argv ) : string = " " . join ( argv ) string = string . split ( ' -' ) program = string [ 0 ] arguments = [ s . split ( ) for s in string [ 1 : ] ] return arguments
python split string in form of command argv
take sys . argv that is used to call a command - line script and return a correctly split list of arguments for example this input : [ eqarea . py - f infile - F outfile - A ] will return this output : [[ f infile ] [ F outfile ] [ A ]]
def extract_args(argv):
    """
    take sys.argv that is used to call a command-line script and return a correctly split list of arguments
    for example, this input: ["eqarea.py", "-f", "infile", "-F", "outfile", "-A"]
    will return this output: [['f', 'infile'], ['F', 'outfile'], ['A']]
    """
    string = " ".join(argv)
    string = string.split(' -')
    program = string[0]
    arguments = [s.split() for s in string[1:]]
    return arguments