笨办法学python——ex13
代码:
from sys import argv
script,first,second,third,= 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)
本人半小白一个,用的Jupyter Notebook在网页上运行python 代码
先在Notepad++上写好上述代码
运行后报错,
not enough values to unpack (expected 4, got 3)
朋友们,百度这么强,不懂就问它啊,接连看来几位大神的解释,终于在https://www.cnblogs.com/daxixixixi/p/9026093.html
看懂了!!!
具体操作为,我在Anoconda Powershell Prompt 上直接输入 python . \ex13.py 11 12 21 程序就跑出来了
👆对了,我写的ex13.py脚本就在python本身运行所在的文件夹里,所以不用转其他盘转到所写的脚本的位置去。
最后,我的理解,需要人为为这个agrv(agrument variable参数变量)赋值,赋值三个。文中大神链接解释得很详细,我就不多说了。