关于s.strip()问题
def is_not_empty(s):
return s and s.strip()
print filter(is_not_empty, ['test', None, '', 'str', ' ', 'END'])
print filter(lambda s:s and s.strip(),['test', None, '', 'str', ' ', 'END'])
# 若 s and s.strip() 这个与命题结果为空字符,那么结果为False.
# 若 s and s.strip() 这个与命题结果为非空字符串,那么结果为True.
我这里不判断len(s.strip())>0 字符串的长度是否为true ,是不是代码更简洁高效一点