【问题标题】:'tuple' object is not callable in python, jupyter [closed]'tuple'对象在python中不可调用,jupyter [关闭]
【发布时间】:2020-09-29 18:57:29
【问题描述】:

我在非常幼稚的 python 代码中收到错误:

mylist = ("a" , "b" , "c")
mylist
mylist
('a', 'b', 'c')
mylist2 =(1, 2, 3,4,5)
mylist2
(1, 2, 3, 4, 5)
mylist(0)
mylist2(0)
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)
<ipython-input-11-8dec3b0af63c> in <module>
----> 1 mylist(0)

TypeError: 'tuple' object is not callable

mylist2(0)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-a2be157acb8f> in <module>
----> 1 mylist2(0)

TypeError: 'tuple' object is not callable

【问题讨论】:

标签: python indexing tuples jupyter


【解决方案1】:

你需要括号而不是括号:

mylist2[0]

【讨论】:

    猜你喜欢
    • 2013-08-27
    • 1970-01-01
    • 1970-01-01
    • 2023-02-01
    • 2021-10-14
    • 2021-03-29
    • 2013-02-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多