【Python】异常:TypeError: ‘str’ object is not callable

问题:在调用字符串转换函数str()时,控制台报错 TypeError: 'str' object is not callable

原因:‘str’ 对象不能被调用
   函数str()是系统自带的,你不能在用它的时候自己同时定义一个别的叫做str的变量,这样会冲突
方法:之前的代码中存在变量str,把之前定义的变量str改成其他名字

参考博文:https://blog.csdn.net/lifelegendc/article/details/55051374

猜你喜欢

转载自blog.csdn.net/Supreme7/article/details/106750362