' argv'在python中总是使用脚本名作为第一个参数?如何避免?
例如,我将调用此sample.py:
window.addEventListener("drop",function(ev){
ev = ev || event;
ev.preventDefault();
},false);
进入终端时
from sys import argv
one, two, three = argv
print "My first number is ", one
print "My second number is ", two
print "My third number is ", three
它返回:
python sample.py one two three
进入终端时:
ValueError: too many values to unpack
它返回:
python sample.py one two
答案 0 :(得分:2)