SyntaxError:print函数中的语法无效

2024-04-27 00:47:15 发布

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

我正在我的MacbookAir上编写下面的脚本,我不清楚这个语法错误是从哪里来的,我试图在google上搜索它为什么会在print函数中的“=”符号处中断。在

我知道有不同的功能可以打印,并尝试了许多。但不清楚我是否使用了正确的Python版本(2和3都已安装)。在

你能帮忙吗?在

我在61行中得到一个错误:

print("The interest rate is too high to trade {}".format(total_profit) , end="\n", file=output_file)

脚本:

^{pr2}$

Tags: the函数功能版本脚本rateis错误
2条回答

print("The interest rate is too high to trade {}".format(total_profit) , end="\n", file=output_file)

Python 3语法。运行python3 your_file.py而不是python your_file.py。在

我认为你没有使用正确的python版本。macos上的默认python版本仍然是python2.X要使用python3.X,您必须用“python3”调用解释器。请尝试以下命令:

Python3PythonMIFIAT.py在

相关问题 更多 >