Skip to main content
 首页 » 编程设计

python之在 Python 中删除列表中的项目

2024年10月25日10birdshome

<分区>

如何在 Python 中只查找和删除列表中的一个元素?

# Example:deleting only the first (1,2) in the list 
a = [(4, 5), (1, 2), (7, 5), (1, 2), (5, 2)] 
# result expected 
a = [(4, 5), (7, 5), (1, 2), (5, 2)]