'str' object is not callable

class Book:def __init__(self, price, color):self.price = priceself.color2 = color # color发生冲突,导致出错eng = Book( 100, 'red')
print('书的价格是:%d ' %eng.price)eng.color2()

原因是color2是一个字符串,结果要调用color2()

不是函数,所以不能call,是not callable的

'str' object is not callable相关推荐

  1. plt.xlabel 'str' object is not callable

    写了那么多年的python居然被这个给搞的老火,哎,真是- 我在画图的时候写了 plt.xlabel = 'x' 运行输出图片,没有坐标,想了一下发现不是等号,而是括号,于是我改写如下: plt.xl ...

  2. Python报错TypeError: 'str' object is not callable

    原文:http://blog.sina.com.cn/s/blog_71f3890901017rsh.html Python报错TypeError: 'str' object is not calla ...

  3. python报错'str' object is not callable

    >>> x=1.235 >>> int(x) 1 >>> str="fsgavfdbafdbntsbgbt" >> ...

  4. 成功解决TypeError: ‘str‘ object is not callable

    成功解决TypeError: 'str' object is not callable 目录 解决问题 解决思路 解决方法 解决问题 TypeError: 'st

  5. python报错:TypeError: 'str' object is not callable

    这个问题遇到好多次了,这次记录一下, 问题重现 代码仅保留最重要的: # summaries 是一个集合 # 求和并打印 result = 0 for str in summaries: result ...

  6. Python中TypeError: ‘str‘ object is not callable

    str( )是python自带函数,是python保留的关键字,定义变量时应该避免使用str作为变量名.如果在使用str( )函数之前已经定义过str变量,则会出现TypeError: 'str' o ...

  7. TypeError: 'str' object is not callable

    Python 报错 TypeError: 'str' object is not callable 原因是我的一个变量名和python api的某个函数名一样,导致 检查你的代码中变量的名字,看有没有 ...

  8. TypeError: 'str' object is not callable (Python)

    2019独角兽企业重金招聘Python工程师标准>>> 在Docker中运行Zeppelin,使用%python解释器. 莫名其妙出现: TypeError: 'str' objec ...

  9. Matplotlib 使用 xlabel(“xxx”)时候报错,‘str‘ object is not callable

    Matplotlib 绘图使用plt.xlabel("xx")报错'str'object is not callable解决方法 这里并不是直接把字符串赋值给 xlabel 例如: ...

最新文章

  1. FTP服务器管理【Linux运维之道之脚本案例】
  2. 3D CNN框架结构各层计算
  3. 使用Docker-Compose搭建高可用redis哨兵集群
  4. mysql acid_Mysql中ACID的原理
  5. (pytorch-深度学习)使用pytorch框架nn.RNN实现循环神经网络
  6. java 中 正则 正则表达式 匹配 url
  7. jave se基础复习2
  8. 【51nod-1521】一维战舰
  9. 【C语言学习】sscanf的简单使用.
  10. Word 之 清除页眉下划线
  11. 网络流媒体(四)———TS流
  12. Pocket 2003,Windows Mobile 5,Windows Mobile 6的部分区别
  13. Centos 7安装tig报错:include/tig/tig.h:83:31: fatal error: ncursesw/curses.h: No such file or directory
  14. 计算机视觉中的双目立体视觉和体积度量
  15. app:processDebugManifest 错误
  16. python列表or字符串切片步长为负数的情况分析
  17. IPhone弹出基于Phonegap的工程的Admob广告
  18. 如何在三维模型中按一定密度提取点云数据(详细说明)
  19. 软件工程 第一周阅读作业
  20. 【网络安全】内网介绍+windows信息收集(含命令)

热门文章

  1. GNU/LINUX(KaliUbuntu)安装chrome浏览器
  2. GDB 内写脚本调试程序
  3. 如何利用魔棒工具抠图_3秒搞定抠图!免费在线抠图工具
  4. linux 给用户tmp权限,linux用户以及权限
  5. linux 虚拟机不能启动不了系统,虚拟机更改linux初始启动5,出现无法启动现象
  6. dede login.php,DedeCms会员登录成功,又跳转到登录页面
  7. mysql自动分区partition_Mysql分区表及自动创建分区Partition
  8. 云服务器_整体服务器与微服务
  9. nb-iot模块的at指令_ESP8266-学习-01 系列了解模块针脚及烧录
  10. MySQL和java连连看_用 JAVA 开发游戏连连看(之一)动手前的准备