函数对象在Python中不能下标吗? [英] Function object is not subscriptable in Python?
本文介绍了函数对象在Python中不能下标吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我尝试通过Python传递它:
So I try to pass this through Python:
print("Strength:",stats[0])
print("Defense:",stats[1])
print("Agility:",stats[2])
...我得到这个回报:
...and I get this in return:
TypeError:函数"对象不可下标
TypeError: 'function' object is not subscriptable
这是什么意思,我该如何解决?
What does this mean and how do I fix it?
推荐答案
这意味着stats
是函数而不是序列.也许您忘记了先前的函数调用中的括号.
It means that stats
is a function instead of a sequence. Perhaps you forgot the parens on an earlier function call.
这篇关于函数对象在Python中不能下标吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文