栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在Spyder中使用argv

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在Spyder中使用argv

阅读页面底部的FAQ,它专门提到了此错误。

常见学生问题

问: 当我运行它时,我得到

ValueError: need more than 1 value to unpack

请记住,一项重要技能是注意细节。如果查看“应该看到的内容”部分,则会看到我在命令行上运行带有参数的脚本。您应该复制我精确运行的方式。

确保运行命令:

$ python ex13.py first 2nd 3rd>> The script is called: ex13.py  >> Your first variable is: first  >> Your second variable is: 2nd  >> Your third variable is: 3rd

您可以确保提供了参数。

if __name__ == '__main__':    if len(argv) == 4:        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    else:        print 'You forgot the args...'


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/514606.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号