[英]INT to STRING conversion in python
I am unable convert int to string
using str()
.我无法使用str()
将 int 转换为string
。 Everywhere on internet I found str()
used to convert int
to string
.在互联网上的任何地方,我都发现str()
用于将int
转换为string
。
I tried to run this on jupyter notebook我试图在jupyter notebook上运行它
My Code:我的代码:
num=23
string=str(num)
Error:错误:
TypeError Traceback (most recent call last)
ipython-input-24-63bcf2e7ab44> in <module>
1 num=23
----> 2 string=str(num)
TypeError: 'str' object is not callable
Somewhere earlier on, you did:在早些时候的某个地方,你做了:
str = 'somestr goes here'
Never name a variable str
;永远不要命名变量str
; it causes this problem.它导致了这个问题。 You can correct it for now with:您现在可以使用以下方法更正它:
del str
but the solution in the future is to never use str
as a variable name.但未来的解决方案是永远不要使用str
作为变量名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.