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

倚天杖
TA贡献1828条经验 获得超3个赞
()
>>> 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
提交
取消