相关疑难解决方法(0)

Python中的递归列表理解?

是否有可能在Python中定义递归列表理解?

可能是一个简单的例子,但有些东西:

nums = [1, 1, 2, 2, 3, 3, 4, 4]
willThisWork = [x for x in nums if x not in self] # self being the current comprehension
Run Code Online (Sandbox Code Playgroud)

有可能这样吗?

python list-comprehension

34
推荐指数
3
解决办法
2万
查看次数

标签 统计

list-comprehension ×1

python ×1