首页 > 编程语言 >【python】Error:'int' object is not callable

【python】Error:'int' object is not callable

时间:2022-10-01 15:56:26浏览次数:48  
标签:obj python object int 报错 Error

1、问题

rpc接口在调用的时候报错 

 

 

2、原因

这个报错的意思就是int转换时,转换的对象不能调用

本次错误,主要是因为int(obj.a) 写成了int(obj.a()), 导致属性获取失败

 

 

3、处理

修改int(obj.a())为int(obj.a) 即可

本质上int转换的对象也就是那字符串,int类型,float类型等,实际调试可以打印看下为啥即可

 

参考链接:

https://blog.csdn.net/scene_2015/article/details/81812357

标签:obj,python,object,int,报错,Error
From: https://www.cnblogs.com/fireblackman/p/16747294.html

相关文章

  • Python爬虫--Requests 库用法大全
    昨晚分享了Python爬虫的基本知识,本文分享一下爬虫里面请求相关的内容:Requests用法。往期知识回顾:​​Python爬虫基本原理​​​​12.奇怪知识(1)--Matlab爬虫获取王者荣耀......
  • Python爬虫基本原理
    1、爬虫是什么爬虫是模拟用户在浏览器或者某个应用上的操作,把操作的过程、实现自动化的程序。当我们在浏览器中输入一个url后回车,后台会发生什么?比如说输入http://www.sina.......
  • python截取字符串(字符串切片)
    python中使用[]来截取字符串,语法:字符串[起始位置:结束位置]一、起始位置:结束位置先看几个例子:s='python'print(s)#输出python直接输出字符串#从前......
  • python题集
    生成全排列n=0vis=[0foriinrange(100)]ans=[0foriinrange(100)]defwork(cnt):ifcnt==n:foriinrange(n):print(ans[i......
  • python引用另一个py文件中的类中函数
    1.获取gpu信息的文件gpu_info.pycatgpu_info.pyimportpynvml#获取GPU信息classGpuInfo(object):def__init__(self):#初始化pynvml......
  • 1.Python环境与数据分析
    今天是科研能力提升强化培训的第一天,简单记录下培训过程一、安装软件1.安装python2.安装anaconda3.安装jupyternotebook4.安装pycharm二、numpy基础1.numpy的ndarr......
  • 流式接口(fluent interface)
    流式接口(fluentinterface)是软件工程中面向对象API的一种实现方式,以提供更为可读的源代码。最早由EricEvans与MartinFowler于2005年提出。通常采取方法瀑布调用(具体......
  • P4084 [USACO17DEC]Barn Painting G
    #include<bits/stdc++.h>usingnamespacestd;constlonglongmod=1e9+7;classDP_on_tree{public: #definelllonglong lln,k; llfree[100001]; llf......
  • python---pefile
    python---pefilepefile可以解析、读取或修改PE文件。github地址:https://github.com/erocarrera/pefile/一些示例地址:https://github.com/erocarrera/pefile/blob/wi......
  • Delete `␍`eslint(prettier/prettier)错误
    使用VSCode开发Vue3项目,编辑的文本中每行都有Delete␍eslint(prettier/prettier)错误,查找原因发现是Windows系统下,按回车时插入回车和换行CRLF两个符号,而这在eslint看来是......