繁体   English   中英

类型错误:'float' 对象在 Python 中没有属性 '__getitem__'

[英]TypeError: 'float' object has no attribute '__getitem__' in Python

我正在用 Python 做一个项目。 我是初学者,在运行程序时出现此错误。

Traceback (most recent call last):
  File "E:/Python/1616/checkProfile.py", line 104, in <module>
    p.getResults()
  File "E:\Python\1616\Profile.py", line 67, in getResults
    for i in range(2): self._s[1]  += e.getS[1]
TypeError: 'float' object has no attribute '__getitem__'


Error in Line 67

http://pastebin.com/HXvppfmU

检查数据类型允许使用哪些方法,

dir(datatype)
# As for float, try dir(float)
#This will suggest you that there is no method called __getitem__ for float.
# You might be trying to get some data or you are using []/()/{} which is not correct. 

尝试发布您的代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM