我已經學習了Python的The Hard Way的第13節。遵循了所有的規則和方向,以實現這一目標。我不是程序員,經常在需要逐步指導的地方遇到困難點。練習13:參數,拆包,變量 - 完全丟失
我已經完成了本節的所有工作,並且我已經命名了我的文件section12.py並保存到我的桌面。我試圖讓這個運行,但不知道如何讓它運行。
這是劇本,我鍵入它:
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
當我運行程序時,我得到以下信息:
========= RESTART: C:\Users\Photo Design Studio\Desktop\section12.py =========
Traceback (most recent call last):
File "C:\Users\Photo Design Studio\Desktop\section12.py", line 3, in <module>
script, first, second, third = argv
ValueError: need more than 1 value to unpack
根據所提供的信息,有人可以給我一步一步指導如何運行這個?
你甚至在談論什麼? – ishaan
打開命令行或終端,根據您的操作系統,將目錄更改爲具有該文件的目錄,輸入cd [cd] [目錄的完整路徑] [Enter],然後鍵入'python section12.py' [Enter],這應該讓它運行。 – Nikita
這是第13節_學習Python的艱辛Way_?您可能希望閱讀[LPTHW Complaints](http://sopython.com/wiki/LPTHW_Complaints)... –