'tuple' 对象在 python 中不可调用,jupyter

'tuple' object is not callable in python, jupyter

我在 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

您需要括号而不是圆括号:

mylist2[0]