代码
from sys import argv
# read the WYSS aection for how to run this
script, first, second, third = argv
print(">>>> argv = ", repr(argv))#还是要看视频啊,这一段书上没有
print("The script is called:", script)
print("Your first variable is", first)
print("Your second variable is", second)
print("Your third variable is", third)
script = input()
first = input()
second = input()
third = input()
script, first, second, third = argv
print(">>>> argv = ", repr(argv))
print("The script is called:", script)
print("Your first variable is", first)
print("Your second variable is", second)
print("Your third variable is", third)
遇到问题
argv并不是很懂
学到的
1、argv的四个参数在后面并不能改;(so, input是在运行脚本时传递参数,而argv这个脚本就是在运行脚本前传递参数,且在脚本运行时并不能改变参数?不知道是不是这样)
2、一个新的解释方法:print(">>>> argv = ", repr(argv))
3、argv的参数数量还可以增加或者减少,都是没问题的,不知道上限是多少。