I even completely copied the code from it (except the last line)
But I do not withdraw “We Are Arguments” , “$ pythone3 using_sys.py we are arguments” , and “using_sys.py”
If that, all my code is:
import sys Print ('Command Arguments:') For i in sys.argv: Print (I)
I seriously do not understand how it works. Help please.
Answer 1, Authority 100%
You do everything right, just do not understand how running programs from the command line. When you run your program, you can transfer the arguments to it, and you can not pass.
Python D: /Python/Test.py Does not contain a single argument, but if you write
python d: /python/test.py we are arguments That will get the desired. At the same time, the file name will always be displayed: the author is
using_sys.py , and you
D: /PYTHON/Test.py and therefore is displayed exactly
D: /Python/Test.py . If you rename the file, you will get again output with the name that is called.
That is, if briefly, the first line of “output” in the book is what you are invited to gain in the console and get the result.