【发布时间】:2018-12-07 18:41:21
【问题描述】:
所以说我有:
a = ['the dog', 'cat', 'the frog went', '3452', 'empty', 'animal']
b = [0, 2, 4]
如何退货:
c = ['the dog', 'the frog went', 'empty'] ?
即如何从 a 返回第 n 个元素,其中 n 包含在单独的列表中?
【问题讨论】:
-
@d_kennetz 根本不是那个的副本,尽管我同意从标题来看它可能看起来像这样。
-
@AlessandroCosentino 前提是一样的。通过索引访问列表中的项目(仅仅因为索引在另一个列表中)并没有太大变化。
标签: python python-2.7 list