parser = argparse.ArgumentParser()
parser.add_argument('--head', dest='size', const=10, default=80, action=
    'store', nargs='?', type=int, help='Only print the head of the output')
print(parser.parse_args(''.split()))
print(parser.parse_args('--head'.split()))
How to make an optional value for argument using argparse?