首页 > 代码库 > python 输入参数解包,模块导入,接收IO输入参数
python 输入参数解包,模块导入,接收IO输入参数
#coding=utf-8from sys import argvscript,first,second,third = argvprint "the script is=",scriptprint "the first is=",firstprint "the second is=",secondprint "the third is=",third"""执行方法 D:\>python heidpython02.py aa bb cc the script is= heidpython02.py the first is= aa the second is= bb the third is= cc""""""参数少于三个D:\>python heidpython02.py aa bbTraceback (most recent call last): File "heidpython02.py", line 4, in <module> script,first,second,third = argvValueError: need more than 3 values to unpack""""""超出三个参数D:\>python heidpython02.py aa bb 66 88Traceback (most recent call last): File "heidpython02.py", line 4, in <module> script,first,second,third = argvValueError: too many values to unpack"""######################接收用户输入#####################print "you name is ?"name=raw_input()print "how old are you?"age=raw_input()print "name:",name,"age:",age
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。