gpt4 book ai didi

python - 为什么出现 EOL 错误以及它的含义是什么?

转载 作者:行者123 更新时间:2023-11-30 23:18:51 28 4
gpt4 key购买 nike

在扫描字符串文字时,它不断出现EOL,但这是什么意思?

这是它不断调用错误的部分:

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.")

最佳答案

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

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

关于python - 为什么出现 EOL 错误以及它的含义是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26473885/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com