数字转为字符串类型报错:TypeError: 'str' object is not callable


Python中数字转化为字符串

  • 报错的写法
### 这样直接转换会报错
num_te = 88888
print(str(num_te))

# 错误信息
# TypeError: 'str' object is not callable

  • 修改后的写法
num_te = 88888
print('%d'%num_te, type('%d'%num_te))
# 结果 =====>成功转化为了str类型
# 88888 <class 'str'>

详细内容请参考: https://blog.csdn.net/bigsea622/article/details/82703190


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM