TypeError:'builtin_function_or_method'对象不可订阅

时间:2017-07-11 05:50:46

标签: python typeerror

我正在使用客户类型的程序,并且使用以下代码发生此错误:

  

TypeError:'builtin_function_or_method'对象不可订阅

    itemData = ["XBOX 360", "200", "NEW"]
    Product = itemData[0]
    Price = itemData[1]
    Condition = itemData[2]
    userSelect = input("Would you like to see the whole information? Yes or No.")
    if userSelect == ("Yes"):
        print[itemData[0], itemData[1], itemData[2]]  
    elif userSelect == ("No"):
        userNoSelect = input("Then would you like to see the details? 
    Command: Product, Price, Condition")
        if userNoSelect == ("Product"):
            print(Product)
        elif userNoSelect == ("Price"):
            print(Price)
        elif userNoSelect == ("Condition"):
            print(Condition)

1 个答案:

答案 0 :(得分:1)

您正尝试下标打印功能。印刷的论点必须写在括号中。尝试:

print(itemData[0], itemData[1], itemData[2]) 

或者如果您想要打印列表:

print([itemData[0], itemData[1], itemData[2]])