python 列表遍历删除
!/usr/bin/python
-- coding: UTF-8 --
方法一
l = ['aadfds','dsa', 'dcver','weiry','11111']
l = [x for x in l if 'a' not in x] #列表解析
print l
方法二
l = ['aadfds','dsa', 'dcver','weiry','11111']
l = filter(lambda x:'a' not in x, l) #filter
print l
方法三
l = ['aadfds','dsa', 'dcver','weiry','11111']
for i in range(len(l)-1,-1,-1): #倒序
if 'a' in l[i]:
del l[i]
print l