笨办法学python 13题:pycharm 运行

笨办法学python 13题

代码:

 1 # -*- coding: utf-8 -*-
 2 from sys import argv
 3 
 4 # argv--argument variable 参数变量
 5 script, first, second, third = argv
 6 
 7 print "the script is called:", script
 8 
 9 print "your first variable is:", first
10 
11 print "your second variable is:", second
12 
13 print "your third variable is:", third

pycharm直接运行时,会报:ValueError: need more than 1 value to unpack

意思是:还需要一个值才能解包

使用pycharm正常运行ex13:edit configurations--parameters输入参数--apply--运行

然后重新点运行,正常运行,并输出结果

 ps:14题同样的运行方式:

user_name作为参数填入parameters中,然后正常运行,可以在控制台进行输入输出显示。

 

 

 

posted @ 2019-06-05 14:03  Alice口袋有糖  阅读(500)  评论(0编辑  收藏  举报