【发布时间】:2018-05-30 14:08:23
【问题描述】:
我想在 Python 中使用列表理解技术生成以下输出
输出:
[[2], [3], [4], [3], [4], [5], [4], [5], [6]]
【问题讨论】:
-
那么,你的问题是什么?
标签: python list list-comprehension
我想在 Python 中使用列表理解技术生成以下输出
输出:
[[2], [3], [4], [3], [4], [5], [4], [5], [6]]
【问题讨论】:
标签: python list list-comprehension
试试:list = [[x+y] for x in range(2,5) for y in range(3)]
输出:
>>> list[[2], [3], [4], [3], [4], [5], [4], [5], [6]]
【讨论】: