Home python I do not understand how to import the SYS Python module. What...

I do not understand how to import the SYS Python module. What am I doing wrong?




I do everything on the book

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”

Only the line “command line arguments” and everything can be seen on the second screenshot

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.

Running Python 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.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions