I want to use forloop to delete some element that meets the conditions.
name_list = ["Win-0.3.4-x86_64", "CentOS7.1"]
for name in name_list:
if "snapshot" not in name:
name_list.remove(name)
print name_list # there print ['CentOS7.1']
But in the end, it do not delete all the elements that meet the condition.