Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
';元组';对象在python中不可调用,jupyter_Python_Indexing_Tuples_Jupyter - Fatal编程技术网

';元组';对象在python中不可调用,jupyter

';元组';对象在python中不可调用,jupyter,python,indexing,tuples,jupyter,Python,Indexing,Tuples,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) ----------------------------------------------------------------------

我在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
mylist=(“a”、“b”、“c”) 迈利斯特 迈利斯特 (‘a’、‘b’、‘c’) mylist2=(1,2,3,4,5) mylist2 (1, 2, 3, 4, 5) mylist(0) mylist2(0) --------------------------------------------------------------------------- TypeError回溯(最近一次调用上次) 在里面 ---->1我的列表(0) TypeError:“tuple”对象不可调用 mylist2(0) --------------------------------------------------------------------------- TypeError回溯(最近一次调用上次) 在里面 ---->1 mylist2(0) TypeError:“tuple”对象不可调用
您需要括号而不是括号:

mylist2[0]

是否希望
mylist[0]
为元组编制索引并获取其第一项?请查看教程。我想答案是浏览一些基本教程。通过示例学习比在这里提问更快。这是否回答了您的问题?这回答了你的问题吗?