【问题标题】:I want to use list comprehension for this code in python我想在 python 中对这段代码使用列表理解
【发布时间】:2022-06-15 19:57:46
【问题描述】:

我有两个列表 lst 和 count 我需要在 lst 上枚举并检查 lst 元素是否存在于 count 中,如果不存在则将其附加到另一个列表中,否则通过。

for i, u in enumerate(lst ):
    if u in count:
        pass
    else:
        _ = sku[i].pop("_id")
        objects.append(sku[i])
I need this code to be in one line

【问题讨论】:

标签: python


猜你喜欢
  • 2020-05-24
  • 2018-02-21
  • 1970-01-01
  • 1970-01-01
  • 2019-02-25
  • 2011-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多