[Python-checkins] Tutorial sys.argv example should not have interactive prompt (GH-94880)
rhettinger
webhook-mailer at python.org
Fri Jul 15 22:10:39 EDT 2022
https://github.com/python/cpython/commit/7502af888f1571150be708da6a8de294e9453a34
commit: 7502af888f1571150be708da6a8de294e9453a34
branch: main
author: Marco Buttu <marco.buttu at gmail.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2022-07-15T21:10:19-05:00
summary:
Tutorial sys.argv example should not have interactive prompt (GH-94880)
files:
M Doc/tutorial/stdlib.rst
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index b32a552d5570c..4f5ada90eb57b 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
More information about the Python-checkins
mailing list