@@ -79,16 +79,16 @@ Following is a result of running the code:
7979
8080.. code-block :: shell-session
8181
82- $ python3 prog.py
83- $ python3 prog.py --help
82+ $ python prog.py
83+ $ python prog.py --help
8484 usage: prog.py [-h]
8585
8686 options:
8787 -h, --help show this help message and exit
88- $ python3 prog.py --verbose
88+ $ python prog.py --verbose
8989 usage: prog.py [-h]
9090 prog.py: error: unrecognized arguments: --verbose
91- $ python3 prog.py foo
91+ $ python prog.py foo
9292 usage: prog.py [-h]
9393 prog.py: error: unrecognized arguments: foo
9494
@@ -121,18 +121,18 @@ And running the code:
121121
122122.. code-block :: shell-session
123123
124- $ python3 prog.py
124+ $ python prog.py
125125 usage: prog.py [-h] echo
126126 prog.py: error: the following arguments are required: echo
127- $ python3 prog.py --help
127+ $ python prog.py --help
128128 usage: prog.py [-h] echo
129129
130130 positional arguments:
131131 echo
132132
133133 options:
134134 -h, --help show this help message and exit
135- $ python3 prog.py foo
135+ $ python prog.py foo
136136 foo
137137
138138 Here is what's happening:
@@ -166,7 +166,7 @@ And we get:
166166
167167.. code-block :: shell-session
168168
169- $ python3 prog.py -h
169+ $ python prog.py -h
170170 usage: prog.py [-h] echo
171171
172172 positional arguments:
@@ -187,7 +187,7 @@ Following is a result of running the code:
187187
188188.. code-block :: shell-session
189189
190- $ python3 prog.py 4
190+ $ python prog.py 4
191191 Traceback (most recent call last):
192192 File "prog.py", line 5, in <module>
193193 print(args.square**2)
@@ -208,9 +208,9 @@ Following is a result of running the code:
208208
209209.. code-block :: shell-session
210210
211- $ python3 prog.py 4
211+ $ python prog.py 4
212212 16
213- $ python3 prog.py four
213+ $ python prog.py four
214214 usage: prog.py [-h] square
215215 prog.py: error: argument square: invalid int value: 'four'
216216
@@ -235,17 +235,17 @@ And the output:
235235
236236.. code-block :: shell-session
237237
238- $ python3 prog.py --verbosity 1
238+ $ python prog.py --verbosity 1
239239 verbosity turned on
240- $ python3 prog.py
241- $ python3 prog.py --help
240+ $ python prog.py
241+ $ python prog.py --help
242242 usage: prog.py [-h] [--verbosity VERBOSITY]
243243
244244 options:
245245 -h, --help show this help message and exit
246246 --verbosity VERBOSITY
247247 increase output verbosity
248- $ python3 prog.py --verbosity
248+ $ python prog.py --verbosity
249249 usage: prog.py [-h] [--verbosity VERBOSITY]
250250 prog.py: error: argument --verbosity: expected one argument
251251
@@ -281,12 +281,12 @@ And the output:
281281
282282.. code-block :: shell-session
283283
284- $ python3 prog.py --verbose
284+ $ python prog.py --verbose
285285 verbosity turned on
286- $ python3 prog.py --verbose 1
286+ $ python prog.py --verbose 1
287287 usage: prog.py [-h] [--verbose]
288288 prog.py: error: unrecognized arguments: 1
289- $ python3 prog.py --help
289+ $ python prog.py --help
290290 usage: prog.py [-h] [--verbose]
291291
292292 options:
@@ -327,9 +327,9 @@ And here goes:
327327
328328.. code-block :: shell-session
329329
330- $ python3 prog.py -v
330+ $ python prog.py -v
331331 verbosity turned on
332- $ python3 prog.py --help
332+ $ python prog.py --help
333333 usage: prog.py [-h] [-v]
334334
335335 options:
@@ -361,14 +361,14 @@ And now the output:
361361
362362.. code-block :: shell-session
363363
364- $ python3 prog.py
364+ $ python prog.py
365365 usage: prog.py [-h] [-v] square
366366 prog.py: error: the following arguments are required: square
367- $ python3 prog.py 4
367+ $ python prog.py 4
368368 16
369- $ python3 prog.py 4 --verbose
369+ $ python prog.py 4 --verbose
370370 the square of 4 equals 16
371- $ python3 prog.py --verbose 4
371+ $ python prog.py --verbose 4
372372 the square of 4 equals 16
373373
374374 * We've brought back a positional argument, hence the complaint.
@@ -397,16 +397,16 @@ And the output:
397397
398398.. code-block :: shell-session
399399
400- $ python3 prog.py 4
400+ $ python prog.py 4
401401 16
402- $ python3 prog.py 4 -v
402+ $ python prog.py 4 -v
403403 usage: prog.py [-h] [-v VERBOSITY] square
404404 prog.py: error: argument -v/--verbosity: expected one argument
405- $ python3 prog.py 4 -v 1
405+ $ python prog.py 4 -v 1
406406 4^2 == 16
407- $ python3 prog.py 4 -v 2
407+ $ python prog.py 4 -v 2
408408 the square of 4 equals 16
409- $ python3 prog.py 4 -v 3
409+ $ python prog.py 4 -v 3
410410 16
411411
412412 These all look good except the last one, which exposes a bug in our program.
@@ -431,10 +431,10 @@ And the output:
431431
432432.. code-block :: shell-session
433433
434- $ python3 prog.py 4 -v 3
434+ $ python prog.py 4 -v 3
435435 usage: prog.py [-h] [-v {0,1,2}] square
436436 prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, 1, 2)
437- $ python3 prog.py 4 -h
437+ $ python prog.py 4 -h
438438 usage: prog.py [-h] [-v {0,1,2}] square
439439
440440 positional arguments:
@@ -473,18 +473,18 @@ to count the number of occurrences of specific options.
473473
474474.. code-block :: shell-session
475475
476- $ python3 prog.py 4
476+ $ python prog.py 4
477477 16
478- $ python3 prog.py 4 -v
478+ $ python prog.py 4 -v
479479 4^2 == 16
480- $ python3 prog.py 4 -vv
480+ $ python prog.py 4 -vv
481481 the square of 4 equals 16
482- $ python3 prog.py 4 --verbosity --verbosity
482+ $ python prog.py 4 --verbosity --verbosity
483483 the square of 4 equals 16
484- $ python3 prog.py 4 -v 1
484+ $ python prog.py 4 -v 1
485485 usage: prog.py [-h] [-v] square
486486 prog.py: error: unrecognized arguments: 1
487- $ python3 prog.py 4 -h
487+ $ python prog.py 4 -h
488488 usage: prog.py [-h] [-v] square
489489
490490 positional arguments:
@@ -493,7 +493,7 @@ to count the number of occurrences of specific options.
493493 options:
494494 -h, --help show this help message and exit
495495 -v, --verbosity increase output verbosity
496- $ python3 prog.py 4 -vvv
496+ $ python prog.py 4 -vvv
497497 16
498498
499499 * Yes, it's now more of a flag (similar to ``action="store_true" ``) in the
@@ -540,11 +540,11 @@ And this is what it gives:
540540
541541.. code-block :: shell-session
542542
543- $ python3 prog.py 4 -vvv
543+ $ python prog.py 4 -vvv
544544 the square of 4 equals 16
545- $ python3 prog.py 4 -vvvv
545+ $ python prog.py 4 -vvvv
546546 the square of 4 equals 16
547- $ python3 prog.py 4
547+ $ python prog.py 4
548548 Traceback (most recent call last):
549549 File "prog.py", line 11, in <module>
550550 if args.verbosity >= 2:
584584
585585.. code-block :: shell-session
586586
587- $ python3 prog.py 4
587+ $ python prog.py 4
588588 16
589589
590590 You can go quite far just with what we've learned so far,
@@ -617,10 +617,10 @@ Output:
617617
618618.. code-block :: shell-session
619619
620- $ python3 prog.py
620+ $ python prog.py
621621 usage: prog.py [-h] [-v] x y
622622 prog.py: error: the following arguments are required: x, y
623- $ python3 prog.py -h
623+ $ python prog.py -h
624624 usage: prog.py [-h] [-v] x y
625625
626626 positional arguments:
@@ -630,7 +630,7 @@ Output:
630630 options:
631631 -h, --help show this help message and exit
632632 -v, --verbosity
633- $ python3 prog.py 4 2 -v
633+ $ python prog.py 4 2 -v
634634 4^2 == 16
635635
636636
@@ -655,11 +655,11 @@ Output:
655655
656656.. code-block :: shell-session
657657
658- $ python3 prog.py 4 2
658+ $ python prog.py 4 2
659659 16
660- $ python3 prog.py 4 2 -v
660+ $ python prog.py 4 2 -v
661661 4^2 == 16
662- $ python3 prog.py 4 2 -vv
662+ $ python prog.py 4 2 -vv
663663 Running 'prog.py'
664664 4^2 == 16
665665
@@ -727,16 +727,16 @@ demonstration. Anyways, here's the output:
727727
728728.. code-block :: shell-session
729729
730- $ python3 prog.py 4 2
730+ $ python prog.py 4 2
731731 4^2 == 16
732- $ python3 prog.py 4 2 -q
732+ $ python prog.py 4 2 -q
733733 16
734- $ python3 prog.py 4 2 -v
734+ $ python prog.py 4 2 -v
735735 4 to the power 2 equals 16
736- $ python3 prog.py 4 2 -vq
736+ $ python prog.py 4 2 -vq
737737 usage: prog.py [-h] [-v | -q] x y
738738 prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
739- $ python3 prog.py 4 2 -v --quiet
739+ $ python prog.py 4 2 -v --quiet
740740 usage: prog.py [-h] [-v | -q] x y
741741 prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
742742
@@ -771,7 +771,7 @@ but not both at the same time:
771771
772772.. code-block :: shell-session
773773
774- $ python3 prog.py --help
774+ $ python prog.py --help
775775 usage: prog.py [-h] [-v | -q] x y
776776
777777 calculate X to the power of Y
0 commit comments