python 实现边遍历边删除
摘要:
边遍历集合边删除元素,会发生删除时跳过元素,如下: my_list = [1, 2, 3, 4, 5] for index, value in enumerate(my_list): item= my_list.pop(index) print(item) print(my_list) 输出结果为: 阅读全文
posted @ 2024-03-06 01:55 白衣风云 阅读(108) 评论(0) 推荐(0)
posted @ 2024-03-06 01:55 白衣风云 阅读(108) 评论(0) 推荐(0)