mirror of https://github.com/python/cpython
Tutorial sys.argv example should not have interactive prompt (GH-94880)
This commit is contained in:
parent
3789c63577
commit
7502af888f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue