【问题标题】:ValueError: not enough values to unpack (expected 4, got 1) in sypderValueError:没有足够的值在 spyder 中解压(预期 4,得到 1)
【发布时间】:2017-04-17 12:26:20
【问题描述】:
 from sys import argv

 script, first, second, third = argv

 print('The script is called'), 'script'
 print('The first varrible is'), 'first'
 print('The second varrible is'), 'second'
 print('The Third Varrible is'), 'third'

Spyder一直提示这个值错误

【问题讨论】:

标签: anaconda python-3.5 spyder


【解决方案1】:

是的,我一开始也遇到了这个问题。 我使用 Command 从 Notepad+ 运行代码。

C:\Users\kxyde>桌面\Python\ex13.py 这个命令是错误的,因为你需要三个值,你必须在“ex13.py”后面输入三个(下图是正确的):

C:\Users\kxyde>桌面\Python\ex13.py first 2nd 3rd

那么,问题解决了!!

【讨论】:

    【解决方案2】:

    解决方案 1

    您还可以决定在尝试查看输出时在命令提示符中添加其他三个参数, 如此处所示--->How to add the three other arguments

    注意

    记住这一点

    "c:\Users\Empress\Desktop\mystuff\ex3.py"

    是我的 python 文件的位置,必须输入它才能在 python 文件中获得我编辑的代码的输出。

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2016-07-05
      • 2023-02-20
      • 2021-08-21
      • 1970-01-01
      • 1970-01-01
      • 2016-04-10
      • 2020-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多