最近在Python脚本中,我一直使用argv
作为“参数变量”,如下面的代码块所示:
# sys is a module and this phrase just says to get the argv feature from that package
from sys import argv
# Take whatever is in argv, unpack it, and assign it to all of these variables on the left in order
script, input_file = argv
下面的两行是否等效于创建“参数变量”-为什么在这种情况下仅import sys
而不是from sys import argv
import sys
script, input_file = sys.argv