lst = ['张无忌','张三丰','张翠山','刘能','张嘉欣','刘嘉玲','刘老根']
new_lst = []
for el in lst:
if '张' in el:
new_lst.append(el)
for el in new_lst:
lst.remove(el)
print(lst)
为什么不能在迭代的同时修改列表和字典的大小
猜你喜欢
转载自www.cnblogs.com/zyyhxbs/p/10994162.html
今日推荐
周排行