700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 【python报错】TypeError: ‘int‘ object is not callable问题原因以及解决办法

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

时间:2020-01-27 22:17:04

相关推荐

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

1.TypeError: ‘int’ object is not callable 报错原因

刚开始学python,在写一段代码的时候python报错:TypeError: ‘int’ object is not callable(int数据类型不能被调用)

出现这个问题的原因是:自己编写的代码中函数变量以及函数名称重复

2.解决办法:修改函数名称或者函数的变量名称,在编写代码的时候一定要牢记命名

class User():

definit(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 += 1print(self.increment_login_attempts)def reset_login_attempts(self):self.increment_login_attempts = 0print(self.increment_login_attempts)`

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。