Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.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中的列表列表中选择一个列表,类似于Mathematics';全部';_Python - Fatal编程技术网

在python中的列表列表中选择一个列表,类似于Mathematics';全部';

在python中的列表列表中选择一个列表,类似于Mathematics';全部';,python,Python,我有一个格式列表: cool_list = [[1, 2, 3, [4, 5, 6, 7]], [1, 2, 3, [4, 5, 6, 7]]] 在现实世界中,数字是不同的,有一定的意义 如何从cool\u列表中的所有数据中选择[4,5,6,7]列表? 我认为mathematica等价物类似于cool\u list[[All],4] 编辑: 输出应该是 [[4, 5, 6, 7], [4, 5, 6, 7]] 如果我没弄错的话,你就去找 third_items = [x[3] for x i

我有一个格式列表:

cool_list = [[1, 2, 3, [4, 5, 6, 7]], [1, 2, 3, [4, 5, 6, 7]]]
在现实世界中,数字是不同的,有一定的意义

如何从
cool\u列表中的所有数据中选择
[4,5,6,7]
列表? 我认为mathematica等价物类似于
cool\u list[[All],4]

编辑:
输出应该是

[[4, 5, 6, 7],
[4, 5, 6, 7]]

如果我没弄错的话,你就去找

third_items = [x[3] for x in cool_list]
last_items = [x[-1] for x in cool_list]

如果我没弄错的话,你就去找

third_items = [x[3] for x in cool_list]
last_items = [x[-1] for x in cool_list]

要将[4,5,6,7]中的所有列表放入一个列表,请执行以下操作:

[x[3] for x in cool_list]
那么输出是:

[[4, 5, 6, 7], [4, 5, 6, 7]]

要将[4,5,6,7]中的所有列表放入一个列表,请执行以下操作:

[x[3] for x in cool_list]
那么输出是:

[[4, 5, 6, 7], [4, 5, 6, 7]]

您根据什么标准寻找
[4,5,6,7]
(其他人不满意的是什么)?您最终想要什么???它总是在列表中的同一个索引上。您根据什么标准寻找
[4,5,6,7]
(其他人不满意的是什么)?你最终想要什么???它总是在列表中的同一个索引上。