我的代码工作在Win机器上找到,python 3.6然后我尝试mac - 终端上的代码,它显示我的错误。也有安装最新版本的Python 我的代码:回溯错误 - 蟒蛇
print ("==================================")
print (" Print all String Character ")
print ("==================================")
word_secund = input("Please add your word: ")
word_one = str(word_secund)
def list(text):
word = 0
for word in text:
print(word)
print (list(word_one))
错误消息:
Please add your word: Slavo
Traceback (most recent call last):
File "strings.py", line 5, in <module>
word_secund = input("Please add your word: ")
File "<string>", line 1, in <module>
NameError: name 'Slavo' is not defined
尝试'raw_input'而不是'input'我怀疑,尽管你已经在你的Mac上安装了最新版本的python,但你的机器上安装了两个python版本,并且默认采用Python2 +。 –
我认为你是对的,我有冲突 – Slavo7