1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| import argparse
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output', action='store_true', help="shows output")
parser.add_argument('--name', required=True)
parser.add_argument('-n', dest='now', action='store_true', help="shows now")
parser.add_argument('-n', type=int, required=True, help="define the number of random integers")
parser.add_argument('-e', type=int, default=2, help="defines the exponent value")
parser.add_argument('-v', type=int, required=True, metavar='value', help="computes cube for the given value")
parser.add_argument('-n', '--name', dest='names', action='append', help="provides names to greet")
parser.add_argument('--chars', type=str, nargs=2, metavar='c',help='starting and ending character')
parser.add_argument('num', type=int, nargs='*')
parser.add_argument('--now', dest='format', choices=['std', 'iso', 'unix', 'tz'], help="shows datetime in given format")
args = parser.parse_args()
print(args)
|