from sys import argvinput(argv)#python自帶的IDLE直接執行不能提供命令行參數script,first,second,third=argvPRint("The script is called:",script)print("Your first variable is :",first)print("Your second variable is :",second)print("Your third variable is :",third)
在IDE中運行該代碼塊報:
Traceback (most recent call last):
  File "D:/ProgramFiles/Python33/workspace/var.py", line 6, in <module>
    script,first,second,third=argv
ValueError: need more than 1 value to unpack
錯誤,IDE中無法輸入命令行參數,所以運行該代碼塊使用命令行運行,并輸入命令行參數
 
  | 
新聞熱點
疑難解答