为什么EOL错误,它是什么意思?

时间:2014-10-20 20:01:06

标签: python string string-literals eol

它不断提出EOL while scanning string literal,但这是什么意思?

这是它一直调用错误的部分:

if health2 <= 3:
  print ("With all the strength you have left you attack one final time to deliver the 
finishing blow. The zombie falls to the ground dead as you stand over it victorious. You can 
now continue your quest to cross the country.")

1 个答案:

答案 0 :(得分:3)

这意味着您的字符串文字格式错误。您需要为multi-line string使用三引号:

if health2 <= 3:
    print ("""With all the strength you have left you attack one final time to deliver 
the finishing blow. The zombie falls to the ground dead as you stand over it victorious. You 
can now continue your quest to cross the country.""")

用单引号括起来的字符串文字不能跨越多行。