十、slack off 2020-05-17 14:53 采纳率: 11.1%
浏览 244

argv无法解包,萌新求解答

#argv无法解包是什么意思
from sys import argv
script, first, second, third = argv
print("The script is called:",script)
print("Your first variable is:", first)
print("Yout second variable is:", second)
print("Yout third variable is:", third)
运行结果提示错误:
Traceback (most recent call last):
File "D:/HQZ/Exercise/Ex13.py", line 2, in
script, first, second, third = argv
ValueError: not enough values to unpack (expected 4, got 1)

  • 写回答

1条回答 默认 最新

  • 吃鸡王者 2020-05-18 10:23
    关注

    你要传入三个参数,才能正常执行,很明显是你传入的参数不够
    要这样执行:
    脚本 参数1 参数2 参数3 参数4

    评论

报告相同问题?