由于我是用的Pycharm,在做这一题的时候给卡着好久,运行的时候总是报错。翻了好多文章才明白怎么做。(小小白一个)。
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)
这是习题的代码,输入进去运行出现了这种情况。
Traceback (most recent call last):
File "E:/pyCharm/projects/ex13.py", line 3, in <module>
script, first, second, third = argv
ValueError: not enough values to unpack (expected 4, got 1)
查了许多网上的内容,自己摸索好久,终于在一篇帖子下面找到了解决方案。由于输入的参数少于三个,才出现问题。解决方法如下:
在Pycharm界面输入 Shift+alt+F10,出现Edit configuration。如下图
点击后,在Pa