Discuss / Python / 问个问题

问个问题

Topic source

def not_empty(s): return s and s.strip() list(filter(not_empty, ['A', '', 'B', None, 'C', ' ']))

这里为什么要 return s and s.strip() 比如s=' ',是返回' '和''么? None就返回None和None?


  • 1

Reply