Python for循环打印错误

标签 python python-3.x

for i in range(10):
    x = 0.1*i
    print x
    print x/(1-x*x)

我正在尝试使用 for 循环打印结果,但它显示 Syntax Error: Missing parentheses in call to 'print' .

我正在使用 Python 3.4,而且我是 Python 新手。

最佳答案

错误消息非常清楚,不是吗?您的print function缺少函数调用所需的括号:

print(x)

Python 2 有一个 print 语句,其中语法 print x 是正确的; Python 3 改变了这一点。您应该从 Python 3 特定资源学习 Python,例如 Python tutorial .

关于Python for循环打印错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27329048/

相关文章:

python - .在没有按我预期的方式运行之后

python - Sklearn TFIDF 矢量器作为并行作业运行

python - 圆素数计划欧拉#35

python - 带有休克数据的 Multiprocessing.Queue 导致 _wait_for_tstate_lock

python - 是否可以创建一个既没有 __slots__ 也没有 __dict__ 的 python 对象?

python - 模型尚未安装或者是抽象的

python - 填充 Pandas 数据框中两列之间的数字

python-3.x - 在每次迭代中训练模型时打印输入

python - python速记表达式中的语法错误

python - 如何在 while 循环中生成不重复的随机数? ( python 3)