|
@@ -5,9 +5,9 @@ import argparse
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- parser = argparse.ArgumentParser()
|
|
|
+ parser = argparse.ArgumentParser(description='A program that shows how argparse works'))
|
|
|
parser.add_argument('printstring', help='A positional argument of a string to print')
|
|
|
- parser.add_argument('--square', help='Print the square of this number.', type=int)
|
|
|
+ parser.add_argument('-s', '--square', help='Print the square of this number.', type=int)
|
|
|
parser.add_argument('--cube', help='Print the cube of this number, or else the cube of 11.', type=int, default=11)
|
|
|
parser.add_argument('--oneorzero', help='Only accepts a 1 or a 0', type=int, choices=[0, 1])
|
|
|
parser.add_argument('--verbose', help='Verbose output.', action='store_true')
|