Skip to main content
 首页 » 编程设计

python之为什么这个对象不可调用对象是项目还是列表

2024年11月24日9落叶

<分区>

我想通过函数打印列表中的项目,但它说

TypeError: 'list' object is not callable 

这是我的代码:

list = ['oi', 'hi', 'hello'] 
def print_item(index): 
    print(list(index)) 

预期的输出是它根据索引打印项目