"python mytest.py v1 v2 "命令运行mytest.py脚本,通过"from sys import argv"如何得到v2的参数值?
A. argv[0]
B. argv[1]
C. argv[2]
D. argv[3]
Using 'python mytest.py v1 v2' command to run the script, how can we get the value of parameter v2 via 'from sys import argv' ?
A. argv[0]
B. argv[1]
C. argv[2]
D. argv[3]
(#1)答案
B,因为赋值语句并不会有返回值,因此y=z+1这个表达式没有返回值,因此不能赋值给x,因此是非法的。实际运行结果见下图
红色箭头表示该语句是非法的语句。
B, as the assignment statements don't have return values, the y=z+1 don't return anything. Thus this can't be assigned to value x and the statement is invalid. The result shown in the picture above.