我正在學習python並出現此錯誤。我可以找出代碼中錯誤的位置。 File "<string>", line 1, in <module>
。python d中的錯誤未定義。
Name = ""
Desc = ""
Gender = ""
Race = ""
# Prompt user for user-defined information
Name = input('What is your Name? ')
Desc = input('Describe yourself: ')
當我運行程序
它輸出 你叫什麼名字? (ⅰ輸入d)
此給出了錯誤
Traceback (most recent call last):
File "/python/chargen.py", line 19, in <module>
Name = input('What is your Name? ')
File "<string>", line 1, in <module>
NameError: name 'd' is not defined
這是從Python 3中的示例代碼初學者。
嗨kennyTM 非常感謝!它看起來像版本衝突:( Python 2.6。4(r264:75706,2009年12月7日,18:45:15) [GCC 4.4.1] on linux2 將升級我的python版本。如果沒有你們,我再也不會想到了:) – dtechie 2010-04-10 10:22:04