在Python中,如果对象是可订阅的,意味着什么?哪些类型的对象属于“可订阅”的域?
3 回答

LEATH
TA贡献1936条经验 获得超6个赞
()
>>> var = "myString">>> def foo(): return 0... >>> var[3]'t'>>> foo[3]Traceback (most recent call last): File "<stdin>", line 1, in <module>TypeError: 'function' object is not subscriptable
function
[]
.
__getitem__()
arr.append["HI"]
TypeError:‘builtin_function_or_method’对象不可订阅
添加回答
举报
0/150
提交
取消