为什么是EOL错误?它意味着什么?

2024-06-28 19:52:38 发布

您现在位置:Python中文网/ 问答频道 /正文

它不断出现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.")

Tags: thetoyoustringif错误withall
1条回答
网友
1楼 · 发布于 2024-06-28 19:52:38

这意味着您的字符串文本格式不正确。您需要对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.""")

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

相关问题 更多 >