summaryrefslogtreecommitdiff
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorMarco Buttu <marco.buttu@gmail.com>2022-07-16 04:10:19 +0200
committerGitHub <noreply@github.com>2022-07-15 21:10:19 -0500
commit7502af888f1571150be708da6a8de294e9453a34 (patch)
treed2dd78818095186db8a225e45a78b297e2ce6250 /Doc/tutorial
parent3789c635772fbdeb5d0fc32aa811fd6b1d935a60 (diff)
downloadcpython-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.rst12
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