Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

argparse positional arguments

import argparse

parser = argparse.ArgumentParser(description='Process some integers.')
# Positional arguments
parser.add_argument('integers', metavar='N', type=int, nargs='+',
                    help='an integer for the accumulator')
# Optional arguments
parser.add_argument('--sum', dest='accumulate', action='store_const',
                    const=sum, default=max,
                    help='sum the integers (default: find the max)')

Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #argparse #positional #arguments
ADD COMMENT
Topic
Name
4+9 =