diff options
| author | Marco Buttu <marco.buttu@gmail.com> | 2022-07-16 04:10:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-15 21:10:19 -0500 |
| commit | 7502af888f1571150be708da6a8de294e9453a34 (patch) | |
| tree | d2dd78818095186db8a225e45a78b297e2ce6250 /Doc/tutorial | |
| parent | 3789c635772fbdeb5d0fc32aa811fd6b1d935a60 (diff) | |
| download | cpython-git-7502af888f1571150be708da6a8de294e9453a34.tar.gz | |
Tutorial sys.argv example should not have interactive prompt (GH-94880)
Diffstat (limited to 'Doc/tutorial')
| -rw-r--r-- | Doc/tutorial/stdlib.rst | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst index b32a552d55..4f5ada90eb 100644 --- a/Doc/tutorial/stdlib.rst +++ b/Doc/tutorial/stdlib.rst @@ -65,11 +65,15 @@ Command Line Arguments Common utility scripts often need to process command line arguments. These arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For -instance the following output results from running ``python demo.py one two -three`` at the command line:: +instance, let's take the following :file:`demo.py` file:: + + # File demo.py + import sys + print(sys.argv) + +Here is the output from running ``python demo.py one two three`` at the command +line:: - >>> import sys - >>> print(sys.argv) ['demo.py', 'one', 'two', 'three'] The :mod:`argparse` module provides a more sophisticated mechanism to process |
