From: Marco Buttu Date: Sat, 16 Jul 2022 02:10:19 +0000 (+0200) Subject: Tutorial sys.argv example should not have interactive prompt (GH-94880) X-Git-Tag: v3.12.0a1~947 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7502af888f1571150be708da6a8de294e9453a34;p=thirdparty%2FPython%2Fcpython.git Tutorial sys.argv example should not have interactive prompt (GH-94880) --- diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst index b32a552d5570..4f5ada90eb57 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