广告
返回顶部
首页 > 资讯 > 后端开发 > Python >【python报错】TypeError: ‘int‘ object is not callable问题原因以及解决办法
  • 751
分享到

【python报错】TypeError: ‘int‘ object is not callable问题原因以及解决办法

2023-08-31 21:08:06 751人浏览 安东尼

Python 官方文档:入门教程 => 点击学习

摘要

TypeError: ‘int’ object is not callable 报错原因 刚开始学python,在写一段代码的时候Python报错:TypeError: ‘int’ object is

TypeError: ‘int’ object is not callable 报错原因
刚开始学python,在写一段代码的时候Python报错:TypeError: ‘int’ object is not callable(int数据类型不能被调用)
出现这个问题的原因是:自己编写的代码中函数变量以及函数名称重复
2.解决办法:修改函数名称或者函数的变量名称,在编写代码的时候一定要牢记命名
class User():
def init(self,first_name,last_name):
self.first_name = first_name
self.last_name = last_name
self.increment_login_attempts = 0

def describe_user(self):    print('this user name is ' + self.first_name + self.last_name)\def greet_user(self):    print("hello " + self.last_name + self.first_name)def increment_login_attempts_read(self):    self.increment_login_attempts += 1    print(self.increment_login_attempts)def reset_login_attempts(self):    self.increment_login_attempts = 0    print(self.increment_login_attempts)`

来源地址:https://blog.csdn.net/SJZSZYH/article/details/127209698

--结束END--

本文标题: 【python报错】TypeError: ‘int‘ object is not callable问题原因以及解决办法

本文链接: https://www.lsjlt.com/news/387099.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作