tuples - 为什么我的语法是错误的?(TypeError:“元组”对象不可调用)
问题描述
我的语法是这样的
print ("Hello!")
print ("Ayah berkata, \"Semangat\"")
print ("Ayah berkata,", end=" ")
print ("\"Semangat\"")
我的输出是这样的
TypeError Traceback (most recent call last)
<ipython-input-8-122075a697db> in <module>()
----> 1 print ("Hello!")
2 print ("Ayah berkata, \"Semangat\"")
3 print ("Ayah berkata,", end=" ")
4 print ("\"Semangat\"")
TypeError: 'tuple' object is not callable
我是 google colab 的代码
解决方案
您创建了一个名为“print”的变量,它是一个元组。您必须删除或重命名变量“print”。
>>> print = ("test", "test") # <- somewhere there might be a linge likethis one
>>> print ("Anything")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object is not callable
推荐阅读
- php - PHP日期时区产生一个小时的意外结果
- ios - React Native - iOS - 辅助功能“粗体文本”设置不加粗应用文本
- amazon-ec2 - Openvpn 客户端只能 ping 同一个 AWS Linux 2 实例中的两个接口之一
- r - R:向量的大小是多少或向量的结构是什么用NULL初始化它
- windows - 如何从内存中运行二进制可执行文件?
- mysql - NodeJS - 使快速服务器处理并行查询 -
- python - 多元回归(梯度下降误差)
- c - Storing and accessing different data types with unsigned short pointer
- python - 在不同位置的画布上无限生成文本(Tkinter)
- bash - 当我添加一个填充数组的 grep 结果时,bash for 循环提前结束,我不知道为什么