【发布时间】:2018-05-14 11:30:23
【问题描述】:
我只是在 github 上克隆一个 repo inconvergent/hyphae 以重用 hyphae.py 并从 python2.6 更新到 python2.7(然后是 3.5)我修复了一些由于更新而导致的错误,但我仍然有 TypeError 用于现在。
完成
从python2.6 更新为pyton2.7.13,添加() 毕竟print
修复
File "/home/user/hyphae/hyphae.py", line 378
main()
^
IndentationError: expected an indented block
通过添加 2 个空格
python2.7 /home/user/hyphae/hyphae.py
何时使用终端
()
('filename', 'generations_a')
('SIZE', 15000)
('ZONEWIDTH', 80.0)
('RAD', 0.002666666666666667)
('ZONES', 187)
('one', 6.666666666666667e-05)
Traceback (most recent call last):
File "/home/user/hyphae/hyphae.py", line 378, in <module>
main()
File "/home/user/hyphae/hyphae.py", line 203, in main
R = np.zeros(NMAX,'float')
TypeError: 'float' object cannot be interpreted as an index
我在 stackoverflow 中被问到关于 TypeError: 'float' object cannot be interpreted as an index 的问题并不多,例如 Here 或 there,但作为我这样的菜鸟,我不知道如何解决这个问题。
【问题讨论】:
标签: python python-2.7 typeerror