+ 1
Someone please explain the sentence:
from sys import argv script, filename=argv
5 ответов
+ 3
The first line import "argv" object from the module "sys" in the current namespace, so it's like we've declared a variable name "argv" and assign it an object. In this case, "argv" is the list of the command line arguments...
The second line declare two variables "script" and "filename", and assign to them the two first element of the list "argv".
So, we could deduce that the Python script which contains these lines ( say it's filename is "my_script.py" ) would be run with at least one arguments...
You mean: why one and not two? Because argv[0] is the filename of the script running. If I call my script like that:
python my_script.py argument1 argument2
We'll have in "argv":
argv[0]=="my_script.py"
argv[1]=="argument1"
argv[2]=="argument2"
+ 3
"A module is a file containing Python definitions and statements."
https://docs.python.org/2/tutorial/modules.html
+ 1
Thanks.
Can you please briefly explain "module"
+ 1
Thanks
Great website by the way
+ 1
Thanks
Great website by the way