Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含字典的列表
[{'item1':xxx, 'item2':xxx}, {'item1':xxx, 'item2':xxx}]
我想删除所有“item1”,所以列表变为:
['item2':xxx}, {'item2':xxx}]
我可以使用的最短语法是什么?我知道您可以使用 for ...循环它,但我正在寻找最简单的语法!谢谢!
最简单的语法是for 循环。
for D in L: del D['item1']