开发者社区 问答 正文

在python3中用argv出错? 400 报错

在python3中用argv出错? 400 报错

在python3.3.2中输入以下代码:

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 "D:\Exercise\ex13.py", line 3, in <module>
    script, first, second, third = argv
ValueError: need more than 1 value to unpack

请问错在哪里?

 

展开
收起
爱吃鱼的程序员 2020-06-02 13:57:16 505 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    我在2.7上运行成功的。######

    你得保存成文件

    然后运行的时候加上足够的参数:

    python Ex13.py 1 2 3

    2020-06-02 13:57:31 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论
问答分类:
问答地址:
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等