我的代碼工作在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