Tutorial sys.argv example should not have interactive prompt (GH-94880)

This commit is contained in:
Marco Buttu 2022-07-16 04:10:19 +02:00 committed by GitHub
parent 3789c63577
commit 7502af888f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -65,11 +65,15 @@ Command Line Arguments
Common utility scripts often need to process command line arguments. These 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 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 instance, let's take the following :file:`demo.py` file::
three`` at the command line::
# 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'] ['demo.py', 'one', 'two', 'three']
The :mod:`argparse` module provides a more sophisticated mechanism to process The :mod:`argparse` module provides a more sophisticated mechanism to process