Python入门之TypeError: 'str' object is not callable错误

今天开始学到python的一些实用函数,在用到str()方法时报了TypeError: 'str' object is not callable错误

以下是我的代码

>>> x=1.235
>>> int(x)
1
>>> str="fsgavfdbafdbntsbgbt"
>>> len(str)
19
>>>
>>> x=987456123
>>> str(x)

然后就报错了

查了一下资料,发现是因为我上面已有定义str变量,定义之后下面的str()方法变成不可调用的了

猜你喜欢

转载自blog.csdn.net/dream_18/article/details/78931723