登录

小甲鱼课后习题不懂,为什么会出现一下BUG

在例子中小甲鱼起了个 str 名字的变量,但事实上我们发现,str 的颜色跟普通变量貌似不同?没错,str() 和 print() 都是内置函数,但 Python 貌似不介意我们对内置函数进行赋值操作,所以这点我们以后就要注意啦,否则可能会出现以下的 BUG:>>> print = 1>>> print("I love FishC")Traceback (most recent call last):  File "<pyshell#37>", line 1, in <module>    print("I love FishC")TypeError: 'int' object is not callable

# Python
笙洺 笙洺 1364 天前 988 次浏览

全部回复(0) 我要回复

暂无回复
  • 取消 回复 发送