2017-04-09 71 views
0
print "Question?", 
answer = raw_input() 

錯誤:打印 「消息」,VAR =的raw_input()

Brians-Air:PythonFiles Ghost$ python ex11.py 
    File "ex11.py", line 1 
    print "How old are you? 
         ^
SyntaxError: EOL while scanning string literal 

我除去 「」 和解釋了一個錯誤。我的想法是,刪除「,」會在這條新的線上提出新的要求和要求。

我的問題是爲什麼在打印聲明之後的「,」是必要的?這只是語法編碼到Python?

+0

錯誤沒有被刪除逗號引起的,效果是完全按照你描述。 – kindall

+0

「解釋者給出了一個錯誤」_什麼是錯誤?_我們不介意讀者。 – Chris

+0

我的壞! 上面的編輯。 – bhpaak

回答

0

這裏是你需要寫什麼:

while True: 
    print 'Question?' 
    answer = raw_input(' >') 
    if answer == ('done'): 
     break 
    print answer